allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [4/16] git commit: [#4339] ticket:247 move discussion thread along with the ticket
Date Mon, 21 Jan 2013 21:53:16 GMT
[#4339] ticket:247 move discussion thread along with the ticket

this ensures ticket's feed work properly after moving


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/16094377
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/16094377
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/16094377

Branch: refs/heads/tv/5336
Commit: 16094377f43634d92d7124d64b450b67845a7126
Parents: 57a43ea
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Dec 21 10:33:45 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Fri Jan 18 21:53:18 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/16094377/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index d7227fd..9a608ce 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -582,12 +582,17 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
                     log.warning('Try to create duplicate ticket %s when moving from %s' %
(self.url(), prior_url))
                     session(self).expunge(self)
                     continue
+        # move ticket's discussion thread, thus all new commnets will go to a new ticket's
feed
+        self.discussion_thread.discussion.app_config_id = app_config._id
+        self.discussion_thread.app_config_id = app_config._id
+        session(self.discussion_thread.discussion).flush(self.discussion_thread.discussion)
+        session(self.discussion_thread).flush(self.discussion_thread)
 
         message = 'Ticket moved from %s' % prior_url
         if messages:
             message += '\n\nCan\'t be converted:\n\n'
         message += '\n'.join(messages)
-        self.discussion_thread.post(text=message)
+        self.discussion_thread.add_post(text=message)
 
         # need this to reset app_config RelationProperty on ticket to a new one
         session(self).expunge(self)


Mime
View raw message