Use commented object as context instead of comment within event trigger
- In order this to work with plone.contentrules use commented object as the main context within custom discussion events and add comment as the second parameter.
This commit is contained in:
@@ -250,16 +250,20 @@ def notify_content_object_deleted(obj, event):
|
||||
def notify_comment_added(obj, event):
|
||||
""" Notify custom discussion events when a comment is added or replied
|
||||
"""
|
||||
conversation = aq_parent(obj)
|
||||
context = aq_parent(conversation)
|
||||
if getattr(obj, 'in_reply_to', None):
|
||||
return notify(ReplyAddedEvent(obj))
|
||||
return notify(CommentAddedEvent(obj))
|
||||
return notify(ReplyAddedEvent(context, obj))
|
||||
return notify(CommentAddedEvent(context, obj))
|
||||
|
||||
def notify_comment_removed(obj, event):
|
||||
""" Notify custom discussion events when a comment or reply is removed
|
||||
"""
|
||||
conversation = aq_parent(obj)
|
||||
context = aq_parent(conversation)
|
||||
if getattr(obj, 'in_reply_to', None):
|
||||
return notify(ReplyRemovedEvent(obj))
|
||||
return notify(CommentRemovedEvent(obj))
|
||||
return notify(ReplyRemovedEvent(context, obj))
|
||||
return notify(CommentRemovedEvent(context, obj))
|
||||
|
||||
def notify_content_object_moved(obj, event):
|
||||
"""Update all comments of a content object that has been moved.
|
||||
|
||||
Reference in New Issue
Block a user