allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] allura git commit: [#8112] no comments in tool-wide blog feed; all feed comments get better links now
Date Tue, 20 Dec 2016 20:54:35 GMT
Repository: allura
Updated Branches:
  refs/heads/db/8112 [created] dcebb49f5


[#8112] no comments in tool-wide blog feed; all feed comments get better links now


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

Branch: refs/heads/db/8112
Commit: be4cae1b5a98c4db36071fca9a31892ed59a5fc2
Parents: 51c7cb2
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Dec 20 15:53:49 2016 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Tue Dec 20 15:53:49 2016 -0500

----------------------------------------------------------------------
 Allura/allura/model/discuss.py                  |  5 +----
 ForgeBlog/forgeblog/main.py                     | 16 ++++++++++++++--
 .../forgeblog/tests/functional/test_feeds.py    | 20 +++++++++++++++++++-
 3 files changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/be4cae1b/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 257ac38..874a888 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -265,14 +265,11 @@ class Thread(Artifact, ActivityObject):
 
     def post_to_feed(self, post):
         if post.status == 'ok':
-            link = None
-            if self.app.tool_label.lower() == 'tickets':
-                link = post.url_paginated()
             Feed.post(
                 self.primary(),
                 title=post.subject,
                 description=post.text,
-                link=link,
+                link=post.url_paginated(),
                 pubdate=post.mod_date,
             )
 

http://git-wip-us.apache.org/repos/asf/allura/blob/be4cae1b/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index cb11239..00e1c2a 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -19,7 +19,7 @@
 import logging
 import urllib2
 import json
-import os
+import re
 
 # Non-stdlib imports
 import pymongo
@@ -35,7 +35,7 @@ from webob import exc
 
 from ming.orm import session
 
-# Pyforge-specific imports
+# Allura-specific imports
 from allura.app import Application, SitemapEntry, ConfigOption
 from allura.app import DefaultAdminController
 from allura.lib import helpers as h
@@ -328,6 +328,18 @@ class RootController(BaseController, FeedController):
             raise exc.HTTPNotFound()
         return PostController(post), rest
 
+    def get_feed(self, project, app, user):
+        """
+        Return a :class:`allura.controllers.feed.FeedArgs` object describing the xml feed
for this controller.
+        Overrides :meth:`allura.controllers.feed.FeedController.get_feed`.
+        """
+        return FeedArgs(
+            dict(project_id=project._id, app_config_id=app.config._id,
+                 link=re.compile(r'^[^#]+$'),  # no target in the link, meaning no comments
+                 ),
+            'Recent posts to %s' % app.config.options.mount_point,
+            app.url)
+
 
 class PostController(BaseController, FeedController):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/be4cae1b/ForgeBlog/forgeblog/tests/functional/test_feeds.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/functional/test_feeds.py b/ForgeBlog/forgeblog/tests/functional/test_feeds.py
index 8bf84ca..d5f29e8 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_feeds.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_feeds.py
@@ -18,10 +18,14 @@
 
 import datetime
 
-from nose.tools import assert_in
+from nose.tools import assert_in, assert_not_in
 from ming.orm.ormsession import ThreadLocalORMSession
+from pylons import tmpl_context as c
+
 from alluratest.controller import TestController
 from allura import model as M
+from allura.lib import helpers as h
+from forgeblog import model as BM
 
 
 class TestFeeds(TestController):
@@ -125,3 +129,17 @@ class TestFeeds(TestController):
         assert '/blog/%s/deletion-post/edit' % d not in response
         response = self.app.get("/blog/feed.rss")
         assert url not in response
+
+    def test_comments_only_in_per_post_feed(self):
+        self._post()
+        blog_post = BM.BlogPost.query.get()
+        with h.push_config(c, user=M.User.query.get(username='test-admin')), \
+             h.push_context(blog_post.project._id, app_config_id=blog_post.app_config_id):
+            blog_post.discussion_thread.add_post(text='You are a good blogger, I am a boring
commentor.')
+        ThreadLocalORMSession.flush_all()
+
+        resp = self.app.get("/blog/" + self._blog_date() + "/my-post/feed.rss")
+        assert_in('boring comment', resp)
+
+        resp = self.app.get("/blog/feed.rss")
+        assert_not_in('boring comment', resp)
\ No newline at end of file


Mime
View raw message