diff --git a/plone/app/discussion/catalog.py b/plone/app/discussion/catalog.py index d45767b..84691c5 100644 --- a/plone/app/discussion/catalog.py +++ b/plone/app/discussion/catalog.py @@ -36,7 +36,7 @@ def last_comment_date(object): @indexer(IContentish, IZCatalog) def commentators(object): conversation = IConversation(object) - return conversation.commentators + return tuple(set(conversation.commentators.keys())) # Comment Indexers diff --git a/plone/app/discussion/conversation.py b/plone/app/discussion/conversation.py index b28054f..6fd488f 100644 --- a/plone/app/discussion/conversation.py +++ b/plone/app/discussion/conversation.py @@ -167,7 +167,7 @@ class Conversation(Traversable, Persistent, Explicit): @property def commentators(self): - return self._commentators.keys() + return self._commentators def objectIds(self): return self._comments.keys() @@ -255,6 +255,10 @@ class Conversation(Traversable, Persistent, Explicit): notify(ObjectAddedEvent(comment.__of__(self), self, id)) notify(ContainerModifiedEvent(self)) + # XXX: This shouldn't be necessary. + content_obj = aq_parent(self) + content_obj.reindexObject() + return id # Dict API diff --git a/plone/app/discussion/tests/test_conversation.py b/plone/app/discussion/tests/test_conversation.py index c8347d0..291e74c 100644 --- a/plone/app/discussion/tests/test_conversation.py +++ b/plone/app/discussion/tests/test_conversation.py @@ -422,6 +422,8 @@ class ConversationTest(PloneTestCase): # object, as we just want to check the Conversation object API. conversation = IConversation(self.portal.doc1) + self.assertEquals(conversation.total_comments, 0) + # Add a four comments from three different users # Note: in real life, we always create # comments via the factory to allow different factories to be