incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] git commit: [#4862] Fix deleted ticket visibility in subproject tracker
Date Wed, 22 May 2013 18:23:34 GMT
Updated Branches:
  refs/heads/master da3c843e7 -> bcbd2d386


[#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/bcbd2d38
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bcbd2d38
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bcbd2d38

Branch: refs/heads/master
Commit: bcbd2d3860f666692bf0aba48a3378d366ee0610
Parents: b897690
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Tue May 21 11:34:02 2013 -0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed May 22 18:23:16 2013 +0000

----------------------------------------------------------------------
 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/bcbd2d38/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 156e147..cf8249f 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -829,7 +829,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/bcbd2d38/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 a934c76..1dc3922 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