diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-02 13:03:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-02 13:03:22 +0000 |
commit | 5fea79504c7483ce589d2f91adf05760e1ba156f (patch) | |
tree | 9e38964bcad523aa170a754bd485ea73a621c5d0 /test/unit/member_test.rb | |
parent | 00481b78c8f508e2faef5b004e8ea5fb560f51ee (diff) | |
download | redmine-5fea79504c7483ce589d2f91adf05760e1ba156f.tar.gz redmine-5fea79504c7483ce589d2f91adf05760e1ba156f.zip |
Don't remove watchers on permission change.
This can be far too slow (especially with membership inheritance) and notifications are not sent to watchers that are not allowed to view the item. If we still want to remove watchers that are no longer able to view the watched items, the redmine:watchers:prune task can be called periodically.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11300 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/member_test.rb')
-rw-r--r-- | test/unit/member_test.rb | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/test/unit/member_test.rb b/test/unit/member_test.rb index 9d1432805..275e16599 100644 --- a/test/unit/member_test.rb +++ b/test/unit/member_test.rb @@ -122,70 +122,4 @@ class MemberTest < ActiveSupport::TestCase assert_equal -1, a <=> b assert_equal 1, b <=> a end - - context "removing permissions" do - setup do - Watcher.delete_all("user_id = 9") - user = User.find(9) - # public - Watcher.create!(:watchable => Issue.find(1), :user => user) - # private - Watcher.create!(:watchable => Issue.find(4), :user => user) - Watcher.create!(:watchable => Message.find(7), :user => user) - Watcher.create!(:watchable => Wiki.find(2), :user => user) - Watcher.create!(:watchable => WikiPage.find(3), :user => user) - end - - context "of user" do - setup do - @member = Member.create!(:project => Project.find(2), :principal => User.find(9), :role_ids => [1, 2]) - end - - context "by deleting membership" do - should "prune watchers" do - assert_difference 'Watcher.count', -4 do - @member.destroy - end - end - end - - context "by updating roles" do - should "prune watchers" do - Role.find(2).remove_permission! :view_wiki_pages - member = Member.first(:order => 'id desc') - assert_difference 'Watcher.count', -2 do - member.role_ids = [2] - member.save - end - assert !Message.find(7).watched_by?(@user) - end - end - end - - context "of group" do - setup do - group = Group.find(10) - @member = Member.create!(:project => Project.find(2), :principal => group, :role_ids => [1, 2]) - group.users << User.find(9) - end - - context "by deleting membership" do - should "prune watchers" do - assert_difference 'Watcher.count', -4 do - @member.destroy - end - end - end - - context "by updating roles" do - should "prune watchers" do - Role.find(2).remove_permission! :view_wiki_pages - assert_difference 'Watcher.count', -2 do - @member.role_ids = [2] - @member.save - end - end - end - end - end end |