diff --git a/CHANGES.txt b/CHANGES.txt
index 471fe61..0f1c159 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,10 @@ Changelog
2.0.6 (unreleased)
------------------
+- Update comment brains in zcatalog when moving a content object with comments.
+ This fixes http://dev.plone.org/plone/ticket/11331.
+ [timo]
+
- Plone 3 specific exclusion of plone.app.uuid removed.
[timo]
diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py
index 6452961..40d4d0d 100644
--- a/plone/app/discussion/comment.py
+++ b/plone/app/discussion/comment.py
@@ -219,6 +219,29 @@ def notify_content_object_deleted(obj, event):
del conversation[conversation.keys()[0]]
+def notify_content_object_moved(obj, event):
+ if event.oldParent is None or event.newParent is None \
+ or event.oldName is None or event.newName is None \
+ or event.oldParent == event.newParent:
+ return
+
+ old_path = "%s/%s" % ('/'.join(event.oldParent.getPhysicalPath()),
+ event.oldName, )
+ new_path = '/'.join(obj.getPhysicalPath())
+ obj.__of__(event.newParent)
+ conversation = IConversation(obj)
+ catalog = getToolByName(obj, 'portal_catalog')
+ from Acquisition import *
+ for brain in catalog.searchResults(portal_type = 'Discussion Item'):
+ catalog.uncatalog_object(brain.getPath())
+ for comment in conversation.getComments():
+ comment.__parent__.__parent__.__of__(event.newParent)
+ comment.__parent__.__parent__.__parent__ = event.newParent
+ catalog.reindexObject(aq_base(comment))
+ catalog.catalog_object(aq_base(comment))
+
+
+
def notify_user(obj, event):
"""Tell users when a comment has been added.
diff --git a/plone/app/discussion/subscribers.zcml b/plone/app/discussion/subscribers.zcml
index 73207ae..6e5e89c 100644
--- a/plone/app/discussion/subscribers.zcml
+++ b/plone/app/discussion/subscribers.zcml
@@ -39,6 +39,12 @@
handler=".comment.notify_content_object_deleted"
/>
+
+