incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [31/48] git commit: [#5074] ticket:188 comments and ticket edits now don't fold
Date Tue, 30 Oct 2012 17:30:06 GMT
[#5074] ticket:188 comments and ticket edits now don't fold


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

Branch: refs/heads/cj/5005
Commit: f234f5dabbbbf2d3e624895a31802f76a10898a6
Parents: 9a021b4
Author: Anton Kasyanov <mind1master@gmail.com>
Authored: Tue Oct 9 14:13:56 2012 +0300
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Oct 15 22:02:26 2012 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   35 +++++++++++++++
 ForgeTracker/forgetracker/tracker_main.py          |   16 +------
 2 files changed, 37 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f234f5da/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 39fffc2..1029830 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -696,6 +696,41 @@ class TestFunctionalController(TrackerTestController):
         assert sidebar_contains(r, 'New')
         assert not sidebar_contains(r, 'Original')
 
+    def test_comment_split(self):
+        summary = 'new ticket'
+        ticket_view = self.new_ticket(summary=summary).follow()                
+        for f in ticket_view.html.findAll('form'):
+            if f.get('action', '').endswith('/post'):
+                break
+        post_content = 'ticket discussion post content'
+        params = dict()
+        inputs = f.findAll('input')
+        for field in inputs:
+            if field.has_key('name'):
+                params[field['name']] = field.has_key('value') and field['value'] or ''
+        params[f.find('textarea')['name']] = post_content
+        r = self.app.post(f['action'].encode('utf-8'), params=params,
+                          headers={'Referer': '/bugs/1/'.encode("utf-8")})
+        r = self.app.get('/bugs/1/', dict(page=1))
+        assert_true(post_content in r)        
+        assert_true(len(r.html.findAll(attrs={'class': 'discussion-post'})) == 1)
+
+        new_summary = 'old ticket'
+        for f in ticket_view.html.findAll('form'):
+            if f.get('action', '').endswith('update_ticket_from_widget'):
+                break                
+        params = dict()
+        inputs = f.findAll('input')
+        for field in inputs:
+            if field.has_key('name'):
+                params[field['name']] = field.has_key('value') and field['value'] or ''
+        params['ticket_form.summary'] = new_summary
+        r = self.app.post(f['action'].encode('utf-8'), params=params,
+                          headers={'Referer': '/bugs/1/'.encode("utf-8")})
+        r = self.app.get('/bugs/1/', dict(page=1))
+        assert_true(summary+' --&gt; '+new_summary in r)   
+        assert_true(len(r.html.findAll(attrs={'class': 'discussion-post'})) == 2)     
+
     def test_discussion_paging(self):
         summary = 'test discussion paging'
         ticket_view = self.new_ticket(summary=summary).follow()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f234f5da/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 8210233..d75a985 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1107,25 +1107,13 @@ class TicketController(BaseController):
                 changes[cf.name[1:]] = cf_val(cf)
                 self.ticket.custom_fields[cf.name] = value
                 changes[cf.name[1:]] = cf_val(cf)
-        thread = self.ticket.discussion_thread
-        latest_post = thread.posts and thread.posts[-1] or None
-        post = None
-        if latest_post and latest_post.author() == c.user:
-            now = datetime.utcnow()
-            folding_window = timedelta(seconds=60*5)
-            if (latest_post.timestamp + folding_window) > now:
-                post = latest_post
-                log.info('Folding ticket updates into %s', post)
+        thread = self.ticket.discussion_thread            
         tpl_fn = pkg_resources.resource_filename(
             'forgetracker', 'data/ticket_changed_tmpl')
         change_text = h.render_genshi_plaintext(
             tpl_fn,
             changelist=changes.get_changed())
-        if post is None:
-            post = thread.add_post(text=change_text)
-        else:
-            post.text += '\n\n' + change_text
-            post.notify(check_dup=True)
+        post = thread.add_post(text=change_text)
         self.ticket.commit()
         if comment:
             self.ticket.discussion_thread.post(text=comment)


Mime
View raw message