allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: [#4862] Fix deleted ticket visibility in subproject tracker
Date Tue, 21 May 2013 15:34:38 GMT
Updated Branches:
  refs/heads/tv/4862 6e045393f -> 4c1cf8fef


[#4862] Fix deleted ticket visibility in subproject tracker

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


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

Branch: refs/heads/tv/4862
Commit: 4c1cf8fefdf48655461c6304074cc1fb016976d1
Parents: 6e04539
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Tue May 21 11:34:02 2013 -0400
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue May 21 11:34:02 2013 -0400

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py          |    2 +-
 .../forgetracker/tests/functional/test_root.py     |   16 ++++++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4c1cf8fe/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 6fb1f80..e4b8c0f 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -824,7 +824,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             tickets = []
             for tn in ticket_numbers:
                 if tn in ticket_for_num:
-                    show_deleted = show_deleted and security.has_access(ticket_for_num[tn],
'delete', user, app_config.project)
+                    show_deleted = show_deleted and security.has_access(ticket_for_num[tn],
'delete', user, app_config.project.root_project)
                     if (security.has_access(ticket_for_num[tn], 'read', user, app_config.project.root_project)
and
                         (show_deleted or ticket_for_num[tn].deleted==False)):
                         tickets.append(ticket_for_num[tn])

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4c1cf8fe/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 84587d7..3af8925 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -178,9 +178,6 @@ class TestSubprojectTrackerController(TrackerTestController):
     def test_index_page_ticket_visibility(self):
         """Test that non-admin users can see tickets created by admins."""
         self.new_ticket(summary="my ticket", mount_point="/sub1/tickets/")
-        ThreadLocalORMSession.flush_all()
-        M.MonQTask.run_ready()
-        ThreadLocalORMSession.flush_all()
         response = self.app.get('/p/test/sub1/tickets/',
                 extra_environ=dict(username='*anonymous'))
         assert 'my ticket' in response
@@ -196,6 +193,19 @@ class TestSubprojectTrackerController(TrackerTestController):
                 extra_environ=dict(username='*anonymous'))
         assert 'my ticket' in response, response.showbrowser()
 
+    @td.with_tool('test/sub1', 'Tickets', 'tickets')
+    def test_deleted_ticket_visibility(self):
+        """Test that admins can see deleted tickets in a subproject tracker."""
+        self.new_ticket(summary='test', mount_point="/sub1/tickets/")
+        self.app.post('/sub1/tickets/1/delete')
+        ThreadLocalORMSession.flush_all()
+        M.MonQTask.run_ready()
+        ThreadLocalORMSession.flush_all()
+        r = self.app.get('/p/test/sub1/tickets/search/',
+                params=dict(q='test', deleted='True'))
+        assert '<td><a href="/p/test/sub1/tickets/1/">test' in r
+        assert '<tr class=" deleted">' in r
+
 
 class TestFunctionalController(TrackerTestController):
     def test_bad_ticket_number(self):


Mime
View raw message