fix delete and publish comment methods.
svn path=/plone.app.discussion/trunk/; revision=27415
This commit is contained in:
parent
9e30b7b3c2
commit
9be49ee767
@ -208,16 +208,15 @@ class DeleteComment(BrowserView):
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
|
||||||
comment = aq_inner(self.context)
|
comment = aq_inner(self.context)
|
||||||
|
comment_id = self.context.id
|
||||||
# Sanity check
|
|
||||||
comment_id = self.request.form['comment_id']
|
|
||||||
if comment_id != comment.getId():
|
|
||||||
raise ValueError
|
|
||||||
|
|
||||||
conversation = self.context.__parent__
|
conversation = self.context.__parent__
|
||||||
|
|
||||||
del conversation[comment_id]
|
del conversation[comment_id]
|
||||||
|
|
||||||
|
self.context.plone_utils.addPortalMessage('Conversation %s deleted' % comment_id)
|
||||||
|
return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER)
|
||||||
|
|
||||||
class PublishComment(BrowserView):
|
class PublishComment(BrowserView):
|
||||||
"""Publish a comment
|
"""Publish a comment
|
||||||
"""
|
"""
|
||||||
@ -225,12 +224,11 @@ class PublishComment(BrowserView):
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
|
||||||
comment = aq_inner(self.context)
|
comment = aq_inner(self.context)
|
||||||
|
comment_id = self.context.id
|
||||||
|
|
||||||
# Sanity check
|
workflow_action = self.request.form['workflow_action']
|
||||||
comment_id = self.request.form['comment_id']
|
|
||||||
if comment_id != comment.getId():
|
|
||||||
raise ValueError
|
|
||||||
|
|
||||||
action = self.request.form['action']
|
|
||||||
portal_workflow = getToolByName(comment, 'portal_workflow')
|
portal_workflow = getToolByName(comment, 'portal_workflow')
|
||||||
portal_workflow.doActionFor(comment, action)
|
portal_workflow.doActionFor(comment, workflow_action)
|
||||||
|
|
||||||
|
self.context.plone_utils.addPortalMessage('Conversation %s workflow action %s' % (comment_id, workflow_action))
|
||||||
|
return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER)
|
||||||
|
Loading…
Reference in New Issue
Block a user