Merge branch 'fix_reindex_on_publish' of git://github.com/RedTurtle/plone.app.discussion into RedTurtle-fix_reindex_on_publish

This commit is contained in:
tisto 2014-03-24 20:49:32 +01:00
commit 01641b4957
2 changed files with 6 additions and 4 deletions

View File

@ -93,6 +93,8 @@ Changelog
to old discussion items that had none. to old discussion items that had none.
[pjstevns] [pjstevns]
- Fix reindexObject for content_object in moderation views.
Now reindex only "total_comments" index and not all the indexes [cekk]
2.2.6 (2013-05-23) 2.2.6 (2013-05-23)
------------------ ------------------

View File

@ -95,7 +95,7 @@ class DeleteComment(BrowserView):
conversation = aq_parent(comment) conversation = aq_parent(comment)
content_object = aq_parent(conversation) content_object = aq_parent(conversation)
del conversation[comment.id] del conversation[comment.id]
content_object.reindexObject() content_object.reindexObject(idxs=['total_comments'])
IStatusMessage(self.context.REQUEST).addStatusMessage( IStatusMessage(self.context.REQUEST).addStatusMessage(
_("Comment deleted."), _("Comment deleted."),
type="info") type="info")
@ -134,7 +134,7 @@ class PublishComment(BrowserView):
workflow_action = self.request.form.get('workflow_action', 'publish') workflow_action = self.request.form.get('workflow_action', 'publish')
workflowTool.doActionFor(comment, workflow_action) workflowTool.doActionFor(comment, workflow_action)
comment.reindexObject() comment.reindexObject()
content_object.reindexObject() content_object.reindexObject(idxs=['total_comments'])
IStatusMessage(self.context.REQUEST).addStatusMessage( IStatusMessage(self.context.REQUEST).addStatusMessage(
_("Comment approved."), _("Comment approved."),
type="info") type="info")
@ -207,7 +207,7 @@ class BulkActionsView(BrowserView):
if current_state != 'published': if current_state != 'published':
workflowTool.doActionFor(comment, 'publish') workflowTool.doActionFor(comment, 'publish')
comment.reindexObject() comment.reindexObject()
content_object.reindexObject() content_object.reindexObject(idxs=['total_comments'])
def mark_as_spam(self): def mark_as_spam(self):
raise NotImplementedError raise NotImplementedError
@ -226,4 +226,4 @@ class BulkActionsView(BrowserView):
conversation = aq_parent(comment) conversation = aq_parent(comment)
content_object = aq_parent(conversation) content_object = aq_parent(conversation)
del conversation[comment.id] del conversation[comment.id]
content_object.reindexObject() content_object.reindexObject(idxs=['total_comments'])