incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [41/50] [abbrv] git commit: [#2502] ticket:300 Fixed bug in filtered_by_subscription
Date Tue, 23 Apr 2013 16:42:45 GMT
[#2502] ticket:300 Fixed bug in filtered_by_subscription


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

Branch: refs/heads/cj/5120
Commit: b01ecfb6a6a482e3337c6d6a17d2041bbb781f89
Parents: 24e8e46
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Apr 17 09:52:57 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Mon Apr 22 19:40:27 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   11 ++++++-----
 ForgeTracker/forgetracker/tracker_main.py          |    8 ++++----
 2 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b01ecfb6/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 91b718c..c21744c 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1222,6 +1222,7 @@ class TestFunctionalController(TrackerTestController):
         users.append(M.User.by_username('test-user-2'))
         admin = M.User.by_username('test-admin')
         tickets[0].subscribe(user=users[0])
+        tickets[0].subscribe(user=users[1])
         tickets[1].subscribe(user=users[1])
         tickets[2].subscribe(user=users[2])
         ThreadLocalORMSession.flush_all()
@@ -1233,8 +1234,8 @@ class TestFunctionalController(TrackerTestController):
         # test-user-2 shoudn't be notified
         # (he has subscription to third ticket, but it didn't change).
         # test-user-0 should see changes only for first ticket.
-        # test-user-1 - only for second.
-        # admin - for both (since he has tool subscription).
+        # test-user-1 - for both (separate subscription for both tickets).
+        # admin - for both (tool subscription).
         changes = {
             tickets[0]._id: tickets[0],
             tickets[1]._id: tickets[1],
@@ -1243,9 +1244,9 @@ class TestFunctionalController(TrackerTestController):
         filtered_users = [uid for uid, data in filtered_changes.iteritems()]
         assert_equal(sorted(filtered_users), sorted([u._id for u in users[:-1] + [admin]]))
         ticket_ids = [t._id for t in tickets]
-        assert_equal(filtered_changes[users[0]._id], ticket_ids[0:1])
-        assert_equal(filtered_changes[users[1]._id], ticket_ids[1:2])
-        assert_equal(sorted(filtered_changes[admin._id]), sorted(ticket_ids[:-1]))
+        assert_equal(filtered_changes[users[0]._id], set(ticket_ids[0:1]))
+        assert_equal(filtered_changes[users[1]._id], set(ticket_ids[:-1]))
+        assert_equal(filtered_changes[admin._id], set(ticket_ids[:-1]))
 
     def test_vote(self):
         r = self.new_ticket(summary='test vote').follow()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b01ecfb6/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 34ee011..396d300 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1220,14 +1220,14 @@ def filtered_by_subscription(tickets, project_id=None, app_config_id=None):
             project_id=p_id,
             app_config_id=ac_id)
         if M.Mailbox.subscribed(**params):
-            filtered[uid] = ticket_ids  # subscribed to entire tool, will see all changes
+            filtered[uid] = set(ticket_ids)  # subscribed to entire tool, will see all changes
             continue
         for t_id, ticket in tickets.iteritems():
             params.update({'artifact': ticket})
             if M.Mailbox.subscribed(**params):
-                if filtered.get('uid') is None:
-                    filtered[uid] = []
-                filtered[uid].append(t_id)
+                if filtered.get(uid) is None:
+                    filtered[uid] = set()
+                filtered[uid].add(t_id)
     return filtered
 
 


Mime
View raw message