@@ -424,7 +424,12 class User < Principal | |||
|
424 | 424 | when 'all' |
|
425 | 425 | true |
|
426 | 426 | when 'selected' |
|
427 | # Handled by the Project | |
|
427 | # user receives notifications for created/assigned issues on unselected projects | |
|
428 | if object.is_a?(Issue) && (object.author == self || object.assigned_to == self) | |
|
429 | true | |
|
430 | else | |
|
431 | false | |
|
432 | end | |
|
428 | 433 | when 'none' |
|
429 | 434 | false |
|
430 | 435 | when 'only_my_events' |
@@ -672,6 +672,7 class UserTest < ActiveSupport::TestCase | |||
|
672 | 672 | |
|
673 | 673 | should "be false for a user with :only_my_events and isn't an author, creator, or assignee" do |
|
674 | 674 | @user = User.generate_with_protected!(:mail_notification => 'only_my_events') |
|
675 | Member.create!(:user => @user, :project => @project, :role_ids => [1]) | |
|
675 | 676 | assert ! @user.notify_about?(@issue) |
|
676 | 677 | end |
|
677 | 678 | |
@@ -704,6 +705,22 class UserTest < ActiveSupport::TestCase | |||
|
704 | 705 | @assignee.update_attribute(:mail_notification, 'only_owner') |
|
705 | 706 | assert ! @assignee.notify_about?(@issue) |
|
706 | 707 | end |
|
708 | ||
|
709 | should "be true for a user with :selected and is the author" do | |
|
710 | @author.update_attribute(:mail_notification, 'selected') | |
|
711 | assert @author.notify_about?(@issue) | |
|
712 | end | |
|
713 | ||
|
714 | should "be true for a user with :selected and is the assignee" do | |
|
715 | @assignee.update_attribute(:mail_notification, 'selected') | |
|
716 | assert @assignee.notify_about?(@issue) | |
|
717 | end | |
|
718 | ||
|
719 | should "be false for a user with :selected and is not the author or assignee" do | |
|
720 | @user = User.generate_with_protected!(:mail_notification => 'selected') | |
|
721 | Member.create!(:user => @user, :project => @project, :role_ids => [1]) | |
|
722 | assert ! @user.notify_about?(@issue) | |
|
723 | end | |
|
707 | 724 | end |
|
708 | 725 | |
|
709 | 726 | context "other events" do |
General Comments 0
You need to be logged in to leave comments.
Login now