diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml index 024912adc44..19b8b9333ea 100644 --- a/config/locales/js-en.yml +++ b/config/locales/js-en.yml @@ -629,9 +629,6 @@ en: mentioned: title: 'I am @mentioned' description: 'Receive a notification every time someone mentions me anywhere' - involved: - title: 'Assigned to me or accountable' - description: 'Receive notifications for all activities on work packages for which I am assignee or accountable' assignee: 'Assignee' responsible: 'Accountable' watched: 'Updates on watched items' diff --git a/db/migrate/20220922200908_add_assignee.rb b/db/migrate/20220922200908_split_involved_notification_setting.rb similarity index 75% rename from db/migrate/20220922200908_add_assignee.rb rename to db/migrate/20220922200908_split_involved_notification_setting.rb index 8e15229d088..dc4dce2953d 100644 --- a/db/migrate/20220922200908_add_assignee.rb +++ b/db/migrate/20220922200908_split_involved_notification_setting.rb @@ -1,4 +1,4 @@ -class AddAssignee < ActiveRecord::Migration[7.0] +class SplitInvolvedNotificationSetting < ActiveRecord::Migration[7.0] def change change_table :notification_settings, bulk: true do |t| t.column :assignee, :boolean, default: false, null: false @@ -8,13 +8,13 @@ class AddAssignee < ActiveRecord::Migration[7.0] reversible do |change| change.up do NotificationSetting.where(involved: true).update_all(assignee: true, responsible: true) - remove_column :notification_settings, :involved, :boolean end change.down do - add_column :notification_settings, :involved, :boolean NotificationSetting.where(assignee: true).or(NotificationSetting.where(responsible: true)).update_all(involved: true) end end + + remove_column :notification_settings, :involved, :boolean end end diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html index e35be13487a..fb9b04cde88 100644 --- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html +++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html @@ -17,9 +17,9 @@ slot="input" />

{{ text.mentioned.description }}

- + - @@ -29,9 +29,9 @@ formControlName="assignee" data-qa-global-notification-type="assignee" /> - + - @@ -41,7 +41,7 @@ formControlName="responsible" data-qa-global-notification-type="responsible" /> - +
{{ text.alsoNotifyFor.title }}

{{ text.alsoNotifyFor.description }}

diff --git a/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb b/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb index e5829200fa9..898cc64bc42 100644 --- a/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb +++ b/modules/documents/spec/services/notifications/create_from_model_service_document_spec.rb @@ -68,10 +68,20 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end @@ -116,10 +126,20 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end diff --git a/spec/services/notifications/create_from_model_service_comment_spec.rb b/spec/services/notifications/create_from_model_service_comment_spec.rb index e651be0b59b..2cc02630539 100644 --- a/spec/services/notifications/create_from_model_service_comment_spec.rb +++ b/spec/services/notifications/create_from_model_service_comment_spec.rb @@ -73,10 +73,20 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jour end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end diff --git a/spec/services/notifications/create_from_model_service_message_spec.rb b/spec/services/notifications/create_from_model_service_message_spec.rb index 1ffec2fd7ce..576509d0b71 100644 --- a/spec/services/notifications/create_from_model_service_message_spec.rb +++ b/spec/services/notifications/create_from_model_service_message_spec.rb @@ -74,10 +74,20 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end @@ -206,10 +216,20 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end diff --git a/spec/services/notifications/create_from_model_service_news_spec.rb b/spec/services/notifications/create_from_model_service_news_spec.rb index 574632496ec..20a6e735a34 100644 --- a/spec/services/notifications/create_from_model_service_news_spec.rb +++ b/spec/services/notifications/create_from_model_service_news_spec.rb @@ -66,10 +66,20 @@ describe Notifications::CreateFromModelService, 'news', with_settings: { journal end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end diff --git a/spec/services/notifications/create_from_model_service_wiki_spec.rb b/spec/services/notifications/create_from_model_service_wiki_spec.rb index 639425c4105..49be3682848 100644 --- a/spec/services/notifications/create_from_model_service_wiki_spec.rb +++ b/spec/services/notifications/create_from_model_service_wiki_spec.rb @@ -72,10 +72,20 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end @@ -165,10 +175,20 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal end end - context 'with the user having registered for assignee and responsible notifications' do + context 'with the user having registered for assignee notifications' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) + ] + end + + it_behaves_like 'creates no notification' + end + + context 'with the user having registered for responsible notifications' do + let(:recipient_notification_settings) do + [ + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end diff --git a/spec/services/notifications/create_from_model_service_work_package_spec.rb b/spec/services/notifications/create_from_model_service_work_package_spec.rb index 212ba90dd08..7c35fb6697d 100644 --- a/spec/services/notifications/create_from_model_service_work_package_spec.rb +++ b/spec/services/notifications/create_from_model_service_work_package_spec.rb @@ -103,7 +103,7 @@ describe Notifications::CreateFromModelService, let(:user_property) { :assigned_to } let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) ] end @@ -150,7 +150,7 @@ describe Notifications::CreateFromModelService, context 'when assignee has all in app notifications enabled but only assignee for mail' do let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(assignee: true)) ] end @@ -194,7 +194,7 @@ describe Notifications::CreateFromModelService, let(:user_property) { :responsible } let(:recipient_notification_settings) do [ - build(:notification_setting, **notification_settings_all_false.merge(assignee: true, responsible: true)) + build(:notification_setting, **notification_settings_all_false.merge(responsible: true)) ] end