OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Turn notification settings from magic symbols into constants
Oliver Günther021e7aaf0fb4
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rbindex 6c69a7ebd15..4e4de8be740 100644--- a/app/models/notification_setting.rb+++ b/app/models/notification_setting.rb@@ -1,4 +1,46 @@class NotificationSetting < ApplicationRecord+ WATCHED = :watched+ ASSIGNED = :assigned+ RESPONSIBLE = :responsible+ MENTIONED = :mentioned+ WORK_PACKAGE_CREATED = :work_package_created+ WORK_PACKAGE_COMMENTED = :work_package_commented+ WORK_PACKAGE_PROCESSED = :work_package_processed+ WORK_PACKAGE_PRIORITIZED = :work_package_prioritized+ WORK_PACKAGE_SCHEDULED = :work_package_scheduled+ NEWS_ADDED = :news_added+ NEWS_COMMENTED = :news_commented+ DOCUMENT_ADDED = :document_added+ FORUM_MESSAGES = :forum_messages+ WIKI_PAGE_ADDED = :wiki_page_added+ WIKI_PAGE_UPDATED = :wiki_page_updated+ MEMBERSHIP_ADDED = :membership_added+ MEMBERSHIP_UPDATED = :membership_updated+ ALL = :all++ def self.all_settings+ [+ WATCHED,+ ASSIGNED,+ RESPONSIBLE,+ MENTIONED,+ WORK_PACKAGE_CREATED,+ WORK_PACKAGE_COMMENTED,+ WORK_PACKAGE_PROCESSED,+ WORK_PACKAGE_PRIORITIZED,+ WORK_PACKAGE_SCHEDULED,+ NEWS_ADDED,+ NEWS_COMMENTED,+ DOCUMENT_ADDED,+ FORUM_MESSAGES,+ WIKI_PAGE_ADDED,+ WIKI_PAGE_UPDATED,+ MEMBERSHIP_ADDED,+ MEMBERSHIP_UPDATED,+ ALL+ ]+ end+enum channel: { in_app: 0, mail: 1, mail_digest: 2 }belongs_to :projectdiff --git a/app/models/users/scopes/notified_globally.rb b/app/models/users/scopes/notified_globally.rbindex 5e5930feef3..5f197d6f902 100644--- a/app/models/users/scopes/notified_globally.rb+++ b/app/models/users/scopes/notified_globally.rb@@ -41,6 +41,7 @@ module Users::Scopesid: NotificationSetting.where(setting => true).where(project: nil)+ .select(:user_id))endenddiff --git a/app/services/notifications/create_from_model_service.rb b/app/services/notifications/create_from_model_service.rbindex 81be0e6cb5f..bf5be02e9f7 100644--- a/app/services/notifications/create_from_model_service.rb+++ b/app/services/notifications/create_from_model_service.rb@@ -118,65 +118,67 @@ class Notifications::CreateFromModelServiceenddef settings_of_mentioned- applicable_settings(mentioned_ids,- project,- :mentioned)+ project_applicable_settings(mentioned_ids,+ project,+ :mentioned)enddef settings_of_assigned- applicable_settings(User.where(id: group_or_user_ids(journal.data.assigned_to)),- project,- :involved)+ project_applicable_settings(User.where(id: group_or_user_ids(journal.data.assigned_to)),+ project,+ NotificationSetting::ASSIGNED)enddef settings_of_responsible- applicable_settings(User.where(id: group_or_user_ids(journal.data.responsible)),- project,- :involved)+ project_applicable_settings(User.where(id: group_or_user_ids(journal.data.responsible)),+ project,+ NotificationSetting::RESPONSIBLE)end+def settings_of_subscribed- applicable_settings(strategy.subscribed_users(model),- project,- :all)+ # Subscribed is a collection of events for non-work packages+ # which currently ignore project-specific overrides+ settings_for_allowed_users(strategy.subscribed_users(model),+ strategy.notification_reason(model))enddef settings_of_watched- applicable_settings(strategy.watcher_users(model),- project,- :watched)+ project_applicable_settings(strategy.watcher_users(model),+ project,+ NotificationSetting::WATCHED)enddef settings_of_commentedreturn NotificationSetting.none unless journal.notes?- applicable_settings(User.all,- project,- :work_package_commented)+ project_applicable_settings(User.all,+ project,+ NotificationSetting::WORK_PACKAGE_COMMENTED)enddef settings_of_createdreturn NotificationSetting.none unless journal.initial?- applicable_settings(User.all,- project,- :work_package_created)+ project_applicable_settings(User.all,+ project,+ NotificationSetting::WORK_PACKAGE_CREATED)enddef settings_of_processedreturn NotificationSetting.none unless !journal.initial? && journal.details.has_key?(:status_id)- applicable_settings(User.all,- project,- :work_package_processed)+ project_applicable_settings(User.all,+ project,+ NotificationSetting::WORK_PACKAGE_PROCESSED)enddef settings_of_prioritizedreturn NotificationSetting.none unless !journal.initial? && journal.details.has_key?(:priority_id)- applicable_settings(User.all,- project,- :work_package_prioritized)+ project_applicable_settings(User.all,+ project,+ NotificationSetting::WORK_PACKAGE_PRIORITIZED)enddef settings_of_scheduled@@ -184,14 +186,18 @@ class Notifications::CreateFromModelServicereturn NotificationSetting.noneend- applicable_settings(User.all,- project,- :work_package_scheduled)+ project_applicable_settings(User.all,+ project,+ NotificationSetting::WORK_PACKAGE_SCHEDULED)end- def applicable_settings(user_scope, project, reason)- NotificationSetting+ def project_applicable_settings(user_scope, project, reason)+ settings_for_allowed_users(user_scope, reason).applicable(project)+ end++ def settings_for_allowed_users(user_scope, reason)+ NotificationSetting.where(reason => true).where(user: user_scope.where(id: User.allowed(strategy.permission, project)))enddiff --git a/app/services/notifications/create_from_model_service/comment_strategy.rb b/app/services/notifications/create_from_model_service/comment_strategy.rbindex 2b78552570b..8301c2365fe 100644--- a/app/services/notifications/create_from_model_service/comment_strategy.rb+++ b/app/services/notifications/create_from_model_service/comment_strategy.rb@@ -50,7 +50,11 @@ module Notifications::CreateFromModelService::CommentStrategyenddef self.subscribed_users(comment)- User.notified_on_all(project(comment))+ User.notified_globally notification_reason(comment)+ end++ def self.notification_reason(_comment)+ NotificationSetting::NEWS_COMMENTEDenddef self.watcher_users(comment)diff --git a/app/services/notifications/create_from_model_service/message_strategy.rb b/app/services/notifications/create_from_model_service/message_strategy.rbindex 096f99d66cb..5f315fc0a3d 100644--- a/app/services/notifications/create_from_model_service/message_strategy.rb+++ b/app/services/notifications/create_from_model_service/message_strategy.rb@@ -50,7 +50,11 @@ module Notifications::CreateFromModelService::MessageStrategyenddef self.subscribed_users(journal)- User.notified_on_all(journal.data.project)+ User.notified_globally notification_reason(journal)+ end++ def self.notification_reason(_journal)+ NotificationSetting::FORUM_MESSAGESenddef self.watcher_users(journal)diff --git a/app/services/notifications/create_from_model_service/news_strategy.rb b/app/services/notifications/create_from_model_service/news_strategy.rbindex 20072e6e898..069d6bd359b 100644--- a/app/services/notifications/create_from_model_service/news_strategy.rb+++ b/app/services/notifications/create_from_model_service/news_strategy.rb@@ -51,13 +51,18 @@ module Notifications::CreateFromModelService::NewsStrategydef self.subscribed_users(journal)if journal.initial?- User.notified_on_all(journal.data.project)+ User.notified_globally notification_reason(journal)else# No notification on updating a newsUser.noneendend+ def self.notification_reason(_journal)+ NotificationSetting::NEWS_ADDED+ end++def self.project(journal)journal.data.projectenddiff --git a/app/services/notifications/create_from_model_service/wiki_content_strategy.rb b/app/services/notifications/create_from_model_service/wiki_content_strategy.rbindex 3f23cfca0da..fd9d20c74e6 100644--- a/app/services/notifications/create_from_model_service/wiki_content_strategy.rb+++ b/app/services/notifications/create_from_model_service/wiki_content_strategy.rb@@ -50,7 +50,15 @@ module Notifications::CreateFromModelService::WikiContentStrategyenddef self.subscribed_users(journal)- User.notified_on_all(journal.data.project)+ User.notified_globally notification_reason(journal)+ end++ def self.notification_reason(journal)+ if journal.initial?+ NotificationSetting::WIKI_PAGE_ADDED+ else+ NotificationSetting::WIKI_PAGE_UPDATED+ endenddef self.watcher_users(journal)diff --git a/app/services/notifications/create_from_model_service/work_package_strategy.rb b/app/services/notifications/create_from_model_service/work_package_strategy.rbindex 5c4de55e066..8f82ad33d6d 100644--- a/app/services/notifications/create_from_model_service/work_package_strategy.rb+++ b/app/services/notifications/create_from_model_service/work_package_strategy.rb@@ -30,7 +30,7 @@module Notifications::CreateFromModelService::WorkPackageStrategydef self.reasons- %i(mentioned assigned responsible watched subscribed commented created processed prioritized scheduled)+ %i(mentioned assigned responsible watched commented created processed prioritized scheduled)enddef self.permissiondiff --git a/frontend/src/app/features/user-preferences/reminder-settings/email-alerts/email-alerts-settings.component.ts b/frontend/src/app/features/user-preferences/reminder-settings/email-alerts/email-alerts-settings.component.tsindex f0ca7449fb8..55daa5d2b37 100644--- a/frontend/src/app/features/user-preferences/reminder-settings/email-alerts/email-alerts-settings.component.ts+++ b/frontend/src/app/features/user-preferences/reminder-settings/email-alerts/email-alerts-settings.component.ts@@ -4,7 +4,6 @@ import {} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';-import { ImmediateRemindersSettings } from 'core-app/features/user-preferences/state/user-preferences.model';import { NotificationSetting } from 'core-app/features/user-preferences/state/notification-setting.model';import { arrayUpdate } from '@datorama/akita';@@ -44,18 +43,16 @@ export class EmailAlertsSettingsComponent {) {}- toggleEnabled(key:string, enabled:boolean) {+ toggleEnabled(key:string, enabled:boolean):void {const delta = { [key]: enabled };this.storeService.store.update(({ notifications }) => ({notifications: arrayUpdate(- notifications, this.matcherFn.bind(this), delta,+ notifications,+ (notification:NotificationSetting) => !notification._links.project.href,+ delta,),}),);}-- private matcherFn(notification:NotificationSetting) {- return !notification._links.project.href;- }}diff --git a/lib/api/v3/user_preferences/notification_setting_representer.rb b/lib/api/v3/user_preferences/notification_setting_representer.rbindex a49c85fd41c..75066a5a78e 100644--- a/lib/api/v3/user_preferences/notification_setting_representer.rb+++ b/lib/api/v3/user_preferences/notification_setting_representer.rb@@ -35,23 +35,23 @@ module APIinclude API::Decorators::LinkedResourceproperty :channel- property :watched- property :involved- property :mentioned- property :work_package_created- property :work_package_commented- property :work_package_processed- property :work_package_prioritized- property :work_package_scheduled- property :news_added- property :news_commented- property :document_added- property :forum_messages- property :wiki_page_added- property :wiki_page_updated- property :membership_added- property :membership_updated- property :all+ property NotificationSetting::WATCHED+ property NotificationSetting::INVOLVED+ property NotificationSetting::MENTIONED+ property NotificationSetting::WORK_PACKAGE_CREATED+ property NotificationSetting::WORK_PACKAGE_COMMENTED+ property NotificationSetting::WORK_PACKAGE_PROCESSED+ property NotificationSetting::WORK_PACKAGE_PRIORITIZED+ property NotificationSetting::WORK_PACKAGE_SCHEDULED+ property NotificationSetting::NEWS_ADDED+ property NotificationSetting::NEWS_COMMENTED+ property NotificationSetting::DOCUMENT_ADDED+ property NotificationSetting::FORUM_MESSAGES+ property NotificationSetting::WIKI_PAGE_ADDED+ property NotificationSetting::WIKI_PAGE_UPDATED+ property NotificationSetting::MEMBERSHIP_ADDED+ property NotificationSetting::MEMBERSHIP_UPDATED+ property NotificationSetting::ALLassociated_resource :project,skip_render: ->(*) { true },diff --git a/modules/documents/app/services/notifications/create_from_model_service/document_strategy.rb b/modules/documents/app/services/notifications/create_from_model_service/document_strategy.rbindex 9569f036242..3f62eb3a68f 100644--- a/modules/documents/app/services/notifications/create_from_model_service/document_strategy.rb+++ b/modules/documents/app/services/notifications/create_from_model_service/document_strategy.rb@@ -50,7 +50,11 @@ module Notifications::CreateFromModelService::DocumentStrategyenddef self.subscribed_users(journal)- User.notified_on_all(project(journal))+ User.notified_globally notification_reason(journal)+ end++ def self.notification_reason(_journal)+ NotificationSetting::DOCUMENT_ADDEDenddef self.project(journal)diff --git a/spec/factories/user_factory.rb b/spec/factories/user_factory.rbindex 799e1decb2c..d522f2f823d 100644--- a/spec/factories/user_factory.rb+++ b/spec/factories/user_factory.rb@@ -58,9 +58,10 @@ FactoryBot.define douser.pref.save unless factory.preferences&.empty?if user.notification_settings.empty?+ all_true = NotificationSetting.all_settings.index_with(true)user.notification_settings = [- FactoryBot.create(:mail_notification_setting, user: user, all: true),- FactoryBot.create(:in_app_notification_setting, user: user, all: true),+ FactoryBot.create(:mail_notification_setting, user: user, **all_true),+ FactoryBot.create(:in_app_notification_setting, user: user, **all_true),FactoryBot.create(:mail_digest_notification_setting, user: user)]enddiff --git a/spec/services/notifications/create_from_journal_job_shared.rb b/spec/services/notifications/create_from_journal_job_shared.rbindex f039a3bdf71..8a1e655bdb6 100644--- a/spec/services/notifications/create_from_journal_job_shared.rb+++ b/spec/services/notifications/create_from_journal_job_shared.rb@@ -51,23 +51,22 @@ shared_context 'with CreateFromJournalJob context' donotification_settings: notification_settings)endlet(:notification_settings_all_false) do- {- all: false,- involved: false,- watched: false,- mentioned: false,- work_package_commented: false,- work_package_processed: false,- work_package_created: false,- work_package_scheduled: false,- work_package_prioritized: false- }+ NotificationSetting+ .all_settings+ .index_with(false)end++ let(:notification_settings_all_true) do+ NotificationSetting+ .all_settings+ .index_with(true)+ end+let(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, all: true),- FactoryBot.build(:in_app_notification_setting, all: true),- FactoryBot.build(:mail_digest_notification_setting, all: true)+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)]endlet(:send_notifications) { true }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.rbindex 41c97dfb1c2..61103b9cfd8 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@@ -127,7 +127,7 @@ describe Notifications::CreateFromModelService,context 'when assignee has in app notifications disabled' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: false, all: true)),+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: false)),FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))]@@ -139,7 +139,7 @@ describe Notifications::CreateFromModelService,read_ian: nil,reason_ian: nil,read_mail: false,- reason_mail: :subscribed,+ reason_mail: :involved,read_mail_digest: false,reason_mail_digest: :assigned}@@ -186,7 +186,7 @@ describe Notifications::CreateFromModelService,let(:recipient_notification_settings) do[FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true)),- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: false, all: true)),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: true))]end@@ -195,7 +195,7 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :subscribed,+ reason_ian: :involved,read_mail: false,reason_mail: :assigned,read_mail_digest: false,@@ -220,9 +220,9 @@ describe Notifications::CreateFromModelService,context 'when assignee has all notifications enabled but made the change himself' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: true, all: true)),- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(involved: true, all: true)),- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(involved: false, all: true))+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)]endlet(:author) { recipient }@@ -257,9 +257,9 @@ describe Notifications::CreateFromModelService,context 'when responsible has in app notifications disabled' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: false, all: true)),+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(involved: false)),FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(all: true))+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)]end@@ -268,10 +268,10 @@ describe Notifications::CreateFromModelService,{read_ian: nil,reason_ian: nil,- read_mail: false,- reason_mail: :subscribed,+ read_mail: nil,+ reason_mail: nil,read_mail_digest: false,- reason_mail_digest: :subscribed+ reason_mail_digest: :involved}endend@@ -327,9 +327,9 @@ describe Notifications::CreateFromModelService,context 'when responsible has all notifications enabled but made the change himself' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, involved: true, all: true),- FactoryBot.build(:mail_digest_notification_setting, involved: true, all: true),- FactoryBot.build(:in_app_notification_setting, involved: true, all: true)+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)]endlet(:author) { recipient }@@ -342,9 +342,9 @@ describe Notifications::CreateFromModelService,let(:user_property) { :watcher }let(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true)),- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true)),- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true))+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)]end@@ -428,9 +428,9 @@ describe Notifications::CreateFromModelService,context 'when watcher has all notifications enabled but made the change himself' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(watched: true, all: true)),- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(watched: true, all: true)),- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(watched: true, all: true))+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true)]endlet(:author) { recipient }@@ -444,9 +444,9 @@ describe Notifications::CreateFromModelService,let(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, all: true),- FactoryBot.build(:mail_digest_notification_setting, all: true),- FactoryBot.build(:in_app_notification_setting, all: true)+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)]end@@ -454,11 +454,11 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :subscribed,+ reason_ian: :created,read_mail: false,- reason_mail: :subscribed,+ reason_mail: :created,read_mail_digest: false,- reason_mail_digest: :subscribed+ reason_mail_digest: :created}endend@@ -466,8 +466,8 @@ describe Notifications::CreateFromModelService,context 'with in app notifications disabled' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(all: true)),- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(all: true)),+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false)]end@@ -478,9 +478,9 @@ describe Notifications::CreateFromModelService,read_ian: nil,reason_ian: nil,read_mail: false,- reason_mail: :subscribed,+ reason_mail: :created,read_mail_digest: false,- reason_mail_digest: :subscribed+ reason_mail_digest: :created}endend@@ -491,7 +491,7 @@ describe Notifications::CreateFromModelService,[FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false),- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(all: true))+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)]end@@ -499,7 +499,7 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :subscribed,+ reason_ian: :created,read_mail: nil,reason_mail: nil,read_mail_digest: nil,@@ -527,10 +527,9 @@ describe Notifications::CreateFromModelService,FactoryBot.build(:mail_notification_setting, **notification_settings_all_false),FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false),FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false),- FactoryBot.build(:mail_notification_setting, project: project, **notification_settings_all_false.merge(all: true)),- FactoryBot.build(:mail_digest_notification_setting, project: project, **notification_settings_all_false- .merge(all: true)),- FactoryBot.build(:in_app_notification_setting, project: project, **notification_settings_all_false.merge(all: true))+ FactoryBot.build(:mail_notification_setting, project: project, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, project: project, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, project: project, **notification_settings_all_true)]end@@ -538,11 +537,11 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :subscribed,+ reason_ian: :created,read_mail: false,- reason_mail: :subscribed,+ reason_mail: :created,read_mail_digest: false,- reason_mail_digest: :subscribed+ reason_mail_digest: :created}endend@@ -551,9 +550,9 @@ describe Notifications::CreateFromModelService,context 'with all enabled as a default but disabled in the project' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, **notification_settings_all_false.merge(all: true)),- FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_false.merge(all: true)),- FactoryBot.build(:in_app_notification_setting, **notification_settings_all_false.merge(all: true)),+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true),FactoryBot.build(:mail_notification_setting, project: project, **notification_settings_all_false),FactoryBot.build(:mail_digest_notification_setting, project: project, **notification_settings_all_false),FactoryBot.build(:in_app_notification_setting, project: project, **notification_settings_all_false)@@ -572,9 +571,9 @@ describe Notifications::CreateFromModelService,context 'when recipient has all notifications enabled but made the change himself' dolet(:recipient_notification_settings) do[- FactoryBot.build(:mail_notification_setting, all: true),- FactoryBot.build(:mail_digest_notification_setting, all: true),- FactoryBot.build(:in_app_notification_setting, all: true)+ FactoryBot.build(:mail_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:mail_digest_notification_setting, **notification_settings_all_true),+ FactoryBot.build(:in_app_notification_setting, **notification_settings_all_true)]endlet(:author) { recipient }