fix reindexObject for comment container object

This commit is contained in:
Andrea Cecchi 2013-08-20 15:37:56 +02:00
parent 7716fb0b82
commit bde1a1a44a
2 changed files with 6 additions and 4 deletions

View File

@ -8,6 +8,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")
@ -135,7 +135,7 @@ class PublishComment(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'])
IStatusMessage(self.context.REQUEST).addStatusMessage( IStatusMessage(self.context.REQUEST).addStatusMessage(
_("Comment approved."), _("Comment approved."),
type="info") type="info")
@ -208,7 +208,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
@ -227,4 +227,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'])