allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject [06/39] allura git commit: [#1731] ticket:775 Don't show deleted posts in moderation list
Date Tue, 02 Jun 2015 20:06:57 GMT
[#1731] ticket:775 Don't show deleted posts in moderation list


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

Branch: refs/heads/hs/7825
Commit: 4788e07bad797a4bc8acfacff9fdbd54708aa247
Parents: 863ca87
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Mon May 25 15:21:11 2015 +0000
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Mon May 25 15:21:11 2015 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py                          | 3 ++-
 .../unit/controllers/test_discussion_moderation_controller.py | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4788e07b/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 1fd24a0..2d9807e 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -435,7 +435,8 @@ class ModerationController(BaseController):
         c.post_filter = WidgetConfig.post_filter
         c.moderate_posts = WidgetConfig.moderate_posts
         query = dict(
-            discussion_id=self.discussion._id)
+            discussion_id=self.discussion._id,
+            deleted=False)
         if status != '-':
             query['status'] = status
         if flag:

http://git-wip-us.apache.org/repos/asf/allura/blob/4788e07b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
index e604222..5f88b0a 100644
--- a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
+++ b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
@@ -17,7 +17,7 @@
 
 from nose.tools import assert_equal
 from mock import Mock, patch
-from ming.orm import ThreadLocalORMSession
+from ming.orm import ThreadLocalORMSession, session
 
 from allura.tests.unit import WithDatabase
 from allura.tests.unit.factories import create_post, create_discussion
@@ -98,6 +98,11 @@ class TestIndexWithAPostInTheDiscussion(WithDatabase):
         assert self.template_variables['pgnum'] == 1
         assert self.template_variables['pages'] == 1
 
+    def test_deleted_post_not_shown(self):
+        self.post.deleted = True
+        session(self.post).flush(self.post)
+        assert self.template_variables['posts'].all() == []
+
 
 def show_moderation_index(discussion, **kwargs_for_controller):
     discussion_controller = Mock()


Mime
View raw message