Project

General

Profile

Defect #39854 ยป defect-39854.patch

Mizuki ISHIKAWA, 2023-12-15 05:48

View differences:

app/models/user.rb
75 75
  MAIL_NOTIFICATION_OPTIONS = [
76 76
    ['all', :label_user_mail_option_all],
77 77
    ['selected', :label_user_mail_option_selected],
78
    ['bookmarked', :label_user_mail_option_bookmarked],
78
    ['bookmarked', :label_user_mail_option_bookmarked_my_projects],
79 79
    ['only_my_events', :label_user_mail_option_only_my_events],
80 80
    ['only_assigned', :label_user_mail_option_only_assigned],
81 81
    ['only_owner', :label_user_mail_option_only_owner],
config/locales/en.yml
942 942
  label_search_titles_only: Search titles only
943 943
  label_user_mail_option_all: "For any event on all my projects"
944 944
  label_user_mail_option_selected: "For any event on the selected projects only..."
945
  label_user_mail_option_bookmarked: "For any event on my bookmarked projects"
945
  label_user_mail_option_bookmarked_my_projects: "For any events on bookmarked my projects"
946 946
  label_user_mail_option_none: "No events"
947 947
  label_user_mail_option_only_my_events: "Only for things I watch or I'm involved in"
948 948
  label_user_mail_option_only_assigned: "Only for things I watch or I am assigned to"
test/unit/project_test.rb
1045 1045
    only_my_events_user = User.generate!(:mail_notification => 'only_my_events')
1046 1046
    Member.create!(:project => project, :roles => [role], :principal => only_my_events_user)
1047 1047

  
1048
    bookmarked_user = User.generate!(:mail_notification => 'bookmarked')
1049
    Member.create!(:project => project, :roles => [role], :principal => bookmarked_user)
1048
    bookmarked_and_member_user = User.generate!(:mail_notification => 'bookmarked')
1049
    Member.create!(:project => project, :roles => [role], :principal => bookmarked_and_member_user)
1050
    pjb = Redmine::ProjectJumpBox.new bookmarked_and_member_user
1051
    pjb.bookmark_project project
1052
    bookmarked_and_member_user.update_notified_bookmarked_project_ids(project)
1053

  
1054
    bookmarked_and_nonmember_user = User.generate!(:mail_notification => 'bookmarked')
1055
    pjb = Redmine::ProjectJumpBox.new bookmarked_and_nonmember_user
1056
    pjb.bookmark_project project
1057
    bookmarked_and_member_user.update_notified_bookmarked_project_ids(project)
1050 1058

  
1051 1059
    only_assigned_user = User.generate!(:mail_notification => 'only_assigned')
1052 1060
    Member.create!(:project => project, :roles => [role], :principal => only_assigned_user)
......
1062 1070
           "should not include users with the 'none' notification option"
1063 1071
    assert !project.notified_users.include?(only_my_events_user),
1064 1072
           "should not include users with the 'only_my_events' notification option"
1065
    assert !project.notified_users.include?(bookmarked_user),
1066
           "should not include users with the 'bookmarked' notification option"
1073
    assert project.notified_users.include?(bookmarked_and_member_user),
1074
           "should include users with the 'bookmarked' notification option"
1075
    assert !project.notified_users.include?(bookmarked_and_nonmember_user),
1076
           "should not include member users with the 'bookmarked' notification option"
1067 1077
    assert !project.notified_users.include?(only_assigned_user),
1068
           "should not include users with the 'only_assigned' notification option"
1078
           "should not include non-member users with the 'only_assigned' notification option"
1069 1079
    assert !project.notified_users.include?(only_owned_user),
1070 1080
           "should not include users with the 'only_owner' notification option"
1071 1081
  end
    (1-1/1)