allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [12/23] git commit: [#6446] ticket:400 in forum api return only ok threads
Date Wed, 31 Jul 2013 19:14:32 GMT
[#6446] ticket:400 in forum api return only ok threads


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

Branch: refs/heads/cj/6461
Commit: 58a2727bd9cf4af9644ecbc2188d7f5b88c52871
Parents: dbb1cb1
Author: Anton Kasyanov <mind1master@gmail.com>
Authored: Mon Jul 22 16:17:11 2013 +0300
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Wed Jul 31 14:55:48 2013 +0000

----------------------------------------------------------------------
 .../forgediscussion/controllers/root.py            |  2 +-
 .../forgediscussion/tests/functional/test_rest.py  | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/58a2727b/ForgeDiscussion/forgediscussion/controllers/root.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/root.py b/ForgeDiscussion/forgediscussion/controllers/root.py
index 7dd18c7..f4354cc 100644
--- a/ForgeDiscussion/forgediscussion/controllers/root.py
+++ b/ForgeDiscussion/forgediscussion/controllers/root.py
@@ -305,7 +305,7 @@ class ForumRestController(BaseController):
                                         num_views=t.num_views,
                                         url=h.absurl('/rest' + t.url()),
                                         last_post=t.last_post)
-                                   for t in topics]
+                                   for t in topics if t.status == 'ok']
         json['count'] = count
         json['page'] = page
         json['limit'] = limit

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/58a2727b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
index 7fc3499..3aca6e0 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
@@ -104,6 +104,23 @@ class TestRootRestController(TestDiscussionApiBase):
         url = 'http://localhost:80/rest/p/test/discussion/general/thread/%s/' % t._id
         assert_equal(topics[1]['url'], url)
 
+    def test_forum_show_ok_topics(self):
+        forum = self.api_get('/rest/p/test/discussion/general/')
+        forum = forum.json['forum']
+        assert_equal(forum['name'], 'General Discussion')
+        topics = forum['topics']
+        assert_equal(len(topics), 2)
+        self.create_topic('general', 'Hi again', 'It should not be shown')
+        t = ForumThread.query.find({'subject': 'Hi again'}).first()
+        first_post = t.first_post
+        first_post.status = u'pending'
+        first_post.commit()
+        forum = self.api_get('/rest/p/test/discussion/general/')
+        forum = forum.json['forum']
+        assert_equal(forum['name'], 'General Discussion')
+        topics = forum['topics']
+        assert_equal(len(topics), 2)
+
     def test_topic(self):
         forum = self.api_get('/rest/p/test/discussion/general/')
         forum = forum.json['forum']


Mime
View raw message