fix depth in migrated comments and add more complex threaded test case.

svn path=/plone.app.discussion/trunk/; revision=28053
This commit is contained in:
Timo Stollenwerk
2009-07-13 21:01:38 +00:00
parent 8bc0b068ae
commit 377f9ddbfd
2 changed files with 53 additions and 8 deletions
+10 -2
View File
@@ -17,7 +17,7 @@ from zope.component import createObject
from plone.app.discussion.comment import CommentFactory
from plone.app.discussion.interfaces import IConversation
from plone.app.discussion.interfaces import IConversation, IReplies
class View(BrowserView):
@@ -65,7 +65,15 @@ class View(BrowserView):
comment.reply_to = in_reply_to
new_in_reply_to = conversation.addComment(comment)
if in_reply_to == 0:
# Direct reply to a content object
new_in_reply_to = conversation.addComment(comment)
else:
# Reply to another comment
comment_to_reply_to = conversation.get(in_reply_to)
replies = IReplies(comment_to_reply_to)
new_in_reply_to = replies.addComment(comment)
self.total_comments_migrated += 1
# migrate all talkbacks of the reply