incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/49] git commit: [#5363] ticket:228 added short url to tracker rss feed
Date Fri, 07 Dec 2012 22:26:35 GMT
[#5363] ticket:228 added short url to tracker rss 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/56332021
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/56332021
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/56332021

Branch: refs/heads/db/4803
Commit: 56332021a84dc4f92beb9b4b5858ec91aa189744
Parents: 16d2c6c
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Thu Dec 6 14:54:32 2012 +0400
Committer: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Committed: Fri Dec 7 03:34:26 2012 +0400

----------------------------------------------------------------------
 Allura/allura/model/artifact.py                    |    8 ++++-
 Allura/allura/model/discuss.py                     |    6 ++++-
 .../forgetracker/tests/functional/test_root.py     |   19 +++++++++++++++
 3 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56332021/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index f155bb8..219b52b 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -621,7 +621,7 @@ class Feed(MappedClass):
 
 
     @classmethod
-    def post(cls, artifact, title=None, description=None, author=None, author_link=None,
author_name=None, pubdate=None):
+    def post(cls, artifact, title=None, description=None, author=None, author_link=None,
author_name=None, pubdate=None, link=None):
         """
         Create a Feed item.  Returns the item.
         But if anon doesn't have read access, create does not happen and None is returned
@@ -643,6 +643,10 @@ class Feed(MappedClass):
         if description is None: description = title
         if pubdate is None:
             pubdate = datetime.utcnow()
+
+        if link is None:
+            link=artifact.url()
+
         item = cls(
             ref_id=artifact.index_id(),
             neighborhood_id=artifact.app_config.project.neighborhood_id,
@@ -651,7 +655,7 @@ class Feed(MappedClass):
             tool_name=artifact.app_config.tool_name,
             title=title,
             description=description,
-            link=artifact.url(),
+            link=link,
             pubdate=pubdate,
             author_name=author_name,
             author_link=author_link or author.url())

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56332021/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 136d2c8..a6a00a9 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -207,7 +207,11 @@ class Thread(Artifact, ActivityObject):
         self.num_replies += 1
         if not self.first_post:
             self.first_post_id = p._id
-        Feed.post(self, title=p.subject, description=p.text)
+        link = None
+        if self.app.tool_label == 'Tickets':
+            link = self.artifact.url() + p.url_paginated()[len(self.url()):]
+
+        Feed.post(self, title=p.subject, description=p.text, link=link)
         return p
 
     def post(self, text, message_id=None, parent_id=None,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56332021/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 afa0366..7ba0598 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -823,6 +823,25 @@ class TestFunctionalController(TrackerTestController):
         r = self.app.get('/bugs/1/', dict(page=1, limit=2))
         assert_true('Page 2 of 2' in r)
 
+    def test_discussion_feed(self):
+        summary = 'test discussion paging'
+        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
+        self.app.post(f['action'].encode('utf-8'), params=params,
+            headers={'Referer': '/bugs/1/'.encode("utf-8")})
+        r = self.app.get('/bugs/feed.rss')
+        post = M.Post.query.find().first()
+        assert '/p/test/bugs/1/?limit=50#' + post.slug in r
+
     def test_bulk_edit_index(self):
         self.new_ticket(summary='test first ticket', status='open')
         self.new_ticket(summary='test second ticket', status='accepted')


Mime
View raw message