allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#7930] ticket:829 Don't update project's last_updated on thread view
Date Wed, 05 Aug 2015 19:27:55 GMT
Repository: allura
Updated Branches:
  refs/heads/master 0015f4792 -> 26d0e066e


[#7930] ticket:829 Don't update project's last_updated on thread view


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

Branch: refs/heads/master
Commit: 26d0e066e2e886ad5d4c4df7d9fb2f4e139208ce
Parents: 0015f47
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Mon Aug 3 17:24:53 2015 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Aug 5 19:00:35 2015 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py                   |  2 ++
 .../forgediscussion/tests/functional/test_forum.py     | 13 +++++++++++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/26d0e066/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index b329b01..df8076d 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -110,6 +110,7 @@ class DiscussionController(BaseController, FeedController):
             else:
                 thread['subscription'] = False
             M.session.artifact_orm_session._get().skip_mod_date = True
+            M.session.artifact_orm_session._get().skip_last_updated = True
         redirect(request.referer)
 
     def get_feed(self, project, app, user):
@@ -193,6 +194,7 @@ class ThreadController(BaseController, FeedController):
         self.thread.num_views += 1
         # the update to num_views shouldn't affect it
         M.session.artifact_orm_session._get().skip_mod_date = True
+        M.session.artifact_orm_session._get().skip_last_updated = True
         count = self.thread.query_posts(page=page, limit=int(limit)).count()
         return dict(discussion=self.thread.discussion,
                     thread=self.thread,

http://git-wip-us.apache.org/repos/asf/allura/blob/26d0e066/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
index ae91bf0..23ec71f 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -831,6 +831,19 @@ class TestForum(TestController):
         r = self.app.get(u'/p/test/discussion/create_topic/téstforum/'.encode('utf-8'))
         assert u'<option value="téstforum" selected>Tést Forum</option>' in
r
 
+    def test_viewing_a_thread_does_not_update_project_last_updated(self):
+        # Create new topic/thread
+        r = self.app.get('/discussion/create_topic/')
+        url = self.fill_new_topic_form(r).submit().follow().request.url
+
+        # Remember project's last_updated
+        timestamp_before = M.Project.query.get(shortname='test').last_updated
+
+        # View the thread and make sure project last_updated is not updated
+        thread = self.app.get(url)
+        timestamp_after = M.Project.query.get(shortname='test').last_updated
+        assert_equal(timestamp_before, timestamp_after)
+
 
 class TestForumStats(TestController):
     def test_stats(self):


Mime
View raw message