allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [14/16] git commit: [#5235] ticket:255 set last_post_date to anonymous' thread
Date Mon, 04 Feb 2013 21:27:04 GMT
[#5235] ticket:255 set last_post_date to anonymous' thread


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

Branch: refs/heads/cj/5705
Commit: 31b664b50547ddaaa430a1f107b27d4c608bd51b
Parents: f6dde31
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Wed Jan 30 10:36:53 2013 +0400
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Mon Feb 4 18:57:17 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/31b664b5/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 97f722c..c537574 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -449,6 +449,9 @@ class ModerationController(BaseController):
                         posted.spam()
                     elif approve and posted.status != 'ok':
                         posted.status = 'ok'
+                        posted.thread.last_post_date = max(
+                            posted.thread.last_post_date,
+                            posted.mod_date)
                         posted.thread.num_replies += 1
         redirect(request.referer)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/31b664b5/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 55027dd..723b409 100644
--- a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
+++ b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
@@ -21,8 +21,11 @@ class TestWhenModerating(WithDatabase):
         self.controller = ModerationController(discussion_controller)
 
     def test_that_it_can_approve(self):
+        mod_date = self.get_post().mod_date
         self.moderate_post(approve=True)
-        assert self.get_post().status == 'ok'
+        post = self.get_post()
+        assert post.status == 'ok'
+        assert post.thread.last_post_date.strftime("%Y-%m-%d %H:%M:%S") == mod_date.strftime("%Y-%m-%d
%H:%M:%S")
 
     def test_that_it_can_mark_as_spam(self):
         self.moderate_post(spam=True)


Mime
View raw message