You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/12/13 22:20:37 UTC

[2/2] git commit: [#5437] ticket:236 added replies to other comments to the RSS feed, added all commetns to the ticket's feed

[#5437] ticket:236 added replies to other comments  to the RSS feed, added all commetns to the ticket's feed


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

Branch: refs/heads/master
Commit: 8f3b938eedf9353c94884648cd5c5f1bf6ac46d1
Parents: d765ac4
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Thu Dec 13 12:01:09 2012 +0400
Committer: Dave Brondsema <db...@geek.net>
Committed: Thu Dec 13 21:20:16 2012 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py               |    3 +-
 Allura/allura/model/discuss.py                     |    4 ++-
 .../forgetracker/tests/functional/test_root.py     |   18 +++++++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8f3b938e/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 0faaeea..4522635 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -320,8 +320,7 @@ class PostController(BaseController):
     def reply(self, **kw):
         require_access(self.thread, 'post')
         kw = self.W.edit_post.to_python(kw, None)
-        self.thread.post(parent_id=self.post._id, **kw)
-        self.thread.num_replies += 1
+        self.thread.add_post(parent_id=self.post._id, **kw)
         redirect(request.referer)
 
     @h.vardec

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8f3b938e/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index a6a00a9..5c1d82e 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -210,7 +210,9 @@ class Thread(Artifact, ActivityObject):
         link = None
         if self.app.tool_label == 'Tickets':
             link = self.artifact.url() + p.url_paginated()[len(self.url()):]
-
+            if self.ref:
+                Feed.post(self.ref.artifact, title=p.subject, description=p.text, link=link)
+                return p
         Feed.post(self, title=p.subject, description=p.text, link=link)
         return p
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8f3b938e/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 7ba0598..b790f9e 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -841,6 +841,24 @@ class TestFunctionalController(TrackerTestController):
         r = self.app.get('/bugs/feed.rss')
         post = M.Post.query.find().first()
         assert '/p/test/bugs/1/?limit=50#' + post.slug in r
+        r = self.app.get('/bugs/1/')
+        post_link = str(r.html.find('div', {'class': 'edit_post_form reply'}).find('form')['action'])
+        post_form = r.html.find('form', {'action': post_link + 'reply'})
+        params = dict()
+        inputs = post_form.findAll('input')
+        for field in inputs:
+            if field.has_key('name'):
+                params[field['name']] = field.has_key('value') and field['value'] or ''
+        params[post_form.find('textarea')['name']] = 'Tis a reply'
+        r = self.app.post(post_link + 'reply',
+            params=params,
+            headers={'Referer':post_link.encode("utf-8")})
+        r = self.app.get('/bugs/feed.rss')
+        assert 'Tis a reply' in r
+        assert 'ticket discussion post content' in r
+        r = self.app.get('/bugs/1/feed.rss')
+        assert 'Tis a reply' in r
+        assert 'ticket discussion post content' in r
 
     def test_bulk_edit_index(self):
         self.new_ticket(summary='test first ticket', status='open')