diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-30 06:02:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-30 06:02:16 +0000 |
commit | 26016fbf432f9be591e243eec8e4d019e86750cc (patch) | |
tree | 326d204b01d60c9295a322586c52c377d3cce51f | |
parent | 307e4ceaa217f34c56763f9881e676150d1e11ca (diff) | |
download | redmine-26016fbf432f9be591e243eec8e4d019e86750cc.tar.gz redmine-26016fbf432f9be591e243eec8e4d019e86750cc.zip |
Merged r4761 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@4767 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/user.rb | 7 | ||||
-rw-r--r-- | test/unit/user_test.rb | 17 |
2 files changed, 23 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 91d6c5fd0..0b3027cab 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -419,7 +419,12 @@ class User < Principal when 'all' true when 'selected' - # Handled by the Project + # user receives notifications for created/assigned issues on unselected projects + if object.is_a?(Issue) && (object.author == self || object.assigned_to == self) + true + else + false + end when 'none' false when 'only_my_events' diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 5f1e41a65..a213332b3 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -455,6 +455,7 @@ class UserTest < ActiveSupport::TestCase should "be false for a user with :only_my_events and isn't an author, creator, or assignee" do @user = User.generate_with_protected!(:mail_notification => 'only_my_events') + Member.create!(:user => @user, :project => @project, :role_ids => [1]) assert ! @user.notify_about?(@issue) end @@ -487,6 +488,22 @@ class UserTest < ActiveSupport::TestCase @assignee.update_attribute(:mail_notification, 'only_owner') assert ! @assignee.notify_about?(@issue) end + + should "be true for a user with :selected and is the author" do + @author.update_attribute(:mail_notification, 'selected') + assert @author.notify_about?(@issue) + end + + should "be true for a user with :selected and is the assignee" do + @assignee.update_attribute(:mail_notification, 'selected') + assert @assignee.notify_about?(@issue) + end + + should "be false for a user with :selected and is not the author or assignee" do + @user = User.generate_with_protected!(:mail_notification => 'selected') + Member.create!(:user => @user, :project => @project, :role_ids => [1]) + assert ! @user.notify_about?(@issue) + end end context "other events" do |