Skip to content

Commit

Permalink
Changes NotifyOnDelete to CommentDeletedEvent and NotifyOnPublish to …
Browse files Browse the repository at this point in the history
…CommentPublishedEvent for respect naming of event and interface
  • Loading branch information
eikichi18 committed Oct 24, 2018
1 parent 65b187e commit 7bd62fa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions plone/app/discussion/browser/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from AccessControl import Unauthorized
from Acquisition import aq_inner
from Acquisition import aq_parent
from plone.app.discussion.events import NotifyOnPublish
from plone.app.discussion.events import NotifyOnDelete
from plone.app.discussion.events import CommentPublishedEvent
from plone.app.discussion.events import CommentDeletedEvent
from plone.app.discussion.interfaces import _
from plone.app.discussion.interfaces import IComment
from plone.app.discussion.interfaces import IReplies
Expand Down Expand Up @@ -103,7 +103,7 @@ def __call__(self):
if self.can_delete(comment):
del conversation[comment.id]
content_object.reindexObject()
notify(NotifyOnDelete(self.context, comment))
notify(CommentDeletedEvent(self.context, comment))
IStatusMessage(self.context.REQUEST).addStatusMessage(
_('Comment deleted.'),
type='info')
Expand Down Expand Up @@ -187,7 +187,7 @@ def __call__(self):
workflowTool.doActionFor(comment, workflow_action)
comment.reindexObject()
content_object.reindexObject(idxs=['total_comments'])
notify(NotifyOnPublish(self.context, comment))
notify(CommentPublishedEvent(self.context, comment))
IStatusMessage(self.context.REQUEST).addStatusMessage(
_('Comment approved.'),
type='info')
Expand Down Expand Up @@ -263,7 +263,7 @@ def publish(self):
workflowTool.doActionFor(comment, 'publish')
comment.reindexObject()
content_object.reindexObject(idxs=['total_comments'])
notify(NotifyOnPublish(content_object, comment))
notify(CommentPublishedEvent(content_object, comment))

def mark_as_spam(self):
raise NotImplementedError
Expand All @@ -283,4 +283,4 @@ def delete(self):
content_object = aq_parent(conversation)
del conversation[comment.id]
content_object.reindexObject(idxs=['total_comments'])
notify(NotifyOnDelete(content_object, comment))
notify(CommentDeletedEvent(content_object, comment))
8 changes: 4 additions & 4 deletions plone/app/discussion/contentrules.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
/>

<interface
interface="plone.app.discussion.interfaces.INotifyOnPublish"
interface="plone.app.discussion.interfaces.ICommentPublishedEvent"
type="plone.contentrules.rule.interfaces.IRuleEventType"
name="Notify user on comment publication"
/>

<interface
interface="plone.app.discussion.interfaces.INotifyOnDelete"
interface="plone.app.discussion.interfaces.ICommentDeletedEvent"
type="plone.contentrules.rule.interfaces.IRuleEventType"
name="Notify user on comment delete"
/>
Expand Down Expand Up @@ -68,12 +68,12 @@
/>

<subscriber
for="plone.app.discussion.interfaces.INotifyOnDelete"
for="plone.app.discussion.interfaces.ICommentDeletedEvent"
handler=".contentrules.execute_comment"
/>

<subscriber
for="plone.app.discussion.interfaces.INotifyOnPublish"
for="plone.app.discussion.interfaces.ICommentPublishedEvent"
handler=".contentrules.execute_comment"
/>

Expand Down
12 changes: 6 additions & 6 deletions plone/app/discussion/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from plone.app.discussion.interfaces import ICommentAddedEvent
from plone.app.discussion.interfaces import ICommentRemovedEvent
from plone.app.discussion.interfaces import IDiscussionEvent
from plone.app.discussion.interfaces import INotifyOnDelete
from plone.app.discussion.interfaces import INotifyOnPublish
from plone.app.discussion.interfaces import ICommentDeletedEvent
from plone.app.discussion.interfaces import ICommentPublishedEvent
from plone.app.discussion.interfaces import IReplyAddedEvent
from plone.app.discussion.interfaces import IReplyRemovedEvent
from zope.interface import implementer
Expand Down Expand Up @@ -52,13 +52,13 @@ class ReplyRemovedEvent(DiscussionEvent):
"""


@implementer(INotifyOnDelete)
class NotifyOnDelete(DiscussionEvent):
@implementer(ICommentDeletedEvent)
class CommentDeletedEvent(DiscussionEvent):
""" Event to be triggered when a Comment is deleted
"""


@implementer(INotifyOnPublish)
class NotifyOnPublish(DiscussionEvent):
@implementer(ICommentPublishedEvent)
class CommentPublishedEvent(DiscussionEvent):
""" Event to be triggered when a Comment is publicated
"""
4 changes: 2 additions & 2 deletions plone/app/discussion/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ class IReplyRemovedEvent(IDiscussionEvent):
"""


class INotifyOnPublish(IDiscussionEvent):
class ICommentPublishedEvent(IDiscussionEvent):
""" Notify user on comment publication
"""


class INotifyOnDelete(IDiscussionEvent):
class ICommentDeletedEvent(IDiscussionEvent):
""" Notify user on comment delete
"""

0 comments on commit 7bd62fa

Please sign in to comment.