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
Remove read_mail, reason_mail, reason_mail_digest
Oliver Günthere3913e61e4fb
diff --git a/app/contracts/notifications/create_contract.rb b/app/contracts/notifications/create_contract.rbindex 3d57b147069..61913ddf6d0 100644--- a/app/contracts/notifications/create_contract.rb+++ b/app/contracts/notifications/create_contract.rb@@ -32,16 +32,13 @@ module Notificationsattribute :recipientattribute :subject- attribute :reason_ian- attribute :reason_mail- attribute :reason_mail_digest+ attribute :reasonattribute :projectattribute :actorattribute :resourceattribute :journalattribute :resource_typeattribute :read_ian- attribute :read_mailattribute :read_mail_digestvalidate :validate_recipient_presentdiff --git a/app/helpers/mail_digest_helper.rb b/app/helpers/mail_digest_helper.rbindex 70900cf54bd..0f64fb1d968 100644--- a/app/helpers/mail_digest_helper.rb+++ b/app/helpers/mail_digest_helper.rb@@ -52,7 +52,7 @@ module MailDigestHelperenddef digest_comment_text(notification)- if notification.reason_mail_digest === "mentioned"+ if notification.reason == "mentioned"sanitize I18n.t(:'mail.digests.work_packages.mentioned')elsesanitize I18n.t(:'mail.digests.work_packages.comment_added')diff --git a/app/helpers/mail_notification_helper.rb b/app/helpers/mail_notification_helper.rbindex a803d8088a1..7e2ad3ea26f 100644--- a/app/helpers/mail_notification_helper.rb+++ b/app/helpers/mail_notification_helper.rb@@ -55,7 +55,7 @@ module MailNotificationHelperdef unique_reasons_of_notifications(notifications)notifications- .map(&:reason_mail_digest)+ .map(&:reason).uniqenddiff --git a/app/mailers/digest_mailer.rb b/app/mailers/digest_mailer.rbindex 41310248890..37ea8b54a75 100644--- a/app/mailers/digest_mailer.rb+++ b/app/mailers/digest_mailer.rb@@ -68,7 +68,7 @@ class DigestMailer < ApplicationMailer@mentioned_count = @aggregated_notifications.values.flatten- .map(&:reason_mail_digest)+ .map(&:reason).compact.count("mentioned")diff --git a/app/models/notification.rb b/app/models/notification.rbindex b6e29302db8..16b2cd11429 100644--- a/app/models/notification.rb+++ b/app/models/notification.rb@@ -12,9 +12,7 @@ class Notification < ApplicationRecordresponsible: 9}.freeze- enum reason_ian: REASONS, _prefix: :ian- enum reason_mail: REASONS, _prefix: :mail- enum reason_mail_digest: REASONS, _prefix: :mail_digest+ enum reason: REASONSbelongs_to :recipient, class_name: 'User'belongs_to :actor, class_name: 'User'@@ -24,7 +22,6 @@ class Notification < ApplicationRecordinclude Scopes::Scopedscopes :unsent_reminders_before,- :unread_mail,:unread_mail_digest,:recipientenddiff --git a/app/models/notifications/scopes/unread_mail.rb b/app/models/notifications/scopes/unread_mail.rbdeleted file mode 100644index d0b6dd873a7..00000000000--- a/app/models/notifications/scopes/unread_mail.rb+++ /dev/null@@ -1,42 +0,0 @@-#-- encoding: UTF-8--#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2021 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++--# Return mail notifications that are unread (have read_mail: false)-module Notifications::Scopes- module UnreadMail- extend ActiveSupport::Concern-- class_methods do- def unread_mail- where(read_mail: false)- end- end- end-enddiff --git a/app/services/notifications/create_from_model_service.rb b/app/services/notifications/create_from_model_service.rbindex 7a83a467e1e..fbd2cbb9d66 100644--- a/app/services/notifications/create_from_model_service.rb+++ b/app/services/notifications/create_from_model_service.rb@@ -75,29 +75,10 @@ class Notifications::CreateFromModelServiceenddef channel_attributes(channel_reasons)- channel_attributes_mail(channel_reasons)- .merge(channel_attributes_mail_digest(channel_reasons))- .merge(channel_attributes_ian(channel_reasons))- end-- def channel_attributes_mail(channel_reasons)- {- read_mail: strategy.supports_mail? && channel_reasons.keys.include?('mail') ? false : nil,- reason_mail: strategy.supports_mail? && channel_reasons['mail']&.first- }- end-- def channel_attributes_mail_digest(channel_reasons)- {- read_mail_digest: strategy.supports_mail_digest? && channel_reasons.keys.include?('mail_digest') ? false : nil,- reason_mail_digest: strategy.supports_mail_digest? && channel_reasons['mail_digest']&.first- }- end-- def channel_attributes_ian(channel_reasons){+ reason: strategy.supports_ian? && channel_reasons['in_app']&.first,read_ian: strategy.supports_ian? && channel_reasons.keys.include?('in_app') ? false : nil,- reason_ian: strategy.supports_ian? && channel_reasons['in_app']&.first+ read_mail_digest: strategy.supports_mail_digest? && channel_reasons.keys.include?('mail_digest') ? false : nil}enddiff --git a/app/workers/notifications/workflow_job.rb b/app/workers/notifications/workflow_job.rbindex f5259a24dbc..818236384b0 100644--- a/app/workers/notifications/workflow_job.rb+++ b/app/workers/notifications/workflow_job.rb@@ -65,7 +65,7 @@ class Notifications::WorkflowJob < ApplicationJobNotification.where(id: notification_ids)- .unread_mail+ .unread_mail # TODO.each do |notification|Notifications::MailService.new(notification)diff --git a/config/locales/en.yml b/config/locales/en.ymlindex dcd87ee5294..c6d4051d537 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -686,14 +686,10 @@ en:attributes:read_ian:read_on_creation: 'cannot be set to true on notification creation.'- read_mail:- read_on_creation: 'cannot be set to true on notification creation.'read_mail_digest:read_on_creation: 'cannot be set to true on notification creation.'- reason_ian:+ reason:no_notification_reason: 'cannot be blank as IAN is chosen as a channel.'- reason_mail:- no_notification_reason: 'cannot be blank as mail is chosen as a channel.'reason_mail_digest:no_notification_reason: 'cannot be blank as mail digest is chosen as a channel.'notification_settings:diff --git a/db/migrate/20210914065555_cleanup_notifications.rb b/db/migrate/20210914065555_cleanup_notifications.rbnew file mode 100644index 00000000000..114ea6dc68b--- /dev/null+++ b/db/migrate/20210914065555_cleanup_notifications.rb@@ -0,0 +1,17 @@+class CleanupNotifications < ActiveRecord::Migration[6.1]+ def up+ change_table :notifications, bulk: true do |t|+ t.remove :read_mail, :reason_mail, :reason_mail_digest+ t.rename :reason_ian, :reason+ end+ end++ def down+ change_table :notifications, bulk: true do |t|+ t.boolean :read_email, default: false, index: true+ t.integer :reason_mail, limit: 1+ t.integer :reason_mail_digest, limit: 1+ t.rename :reason, :reason_ian+ end+ end+enddiff --git a/lib/api/v3/notifications/notification_representer.rb b/lib/api/v3/notifications/notification_representer.rbindex 9c3ee2fe596..901f0a03813 100644--- a/lib/api/v3/notifications/notification_representer.rb+++ b/lib/api/v3/notifications/notification_representer.rb@@ -46,8 +46,7 @@ module APIproperty :read_ian,as: :readIAN- property :reason_ian,- as: :reason+ property :reasondate_time_property :created_atdiff --git a/lib/api/v3/notifications/notifications_api.rb b/lib/api/v3/notifications/notifications_api.rbindex 84922f5e94e..be865c8f660 100644--- a/lib/api/v3/notifications/notifications_api.rb+++ b/lib/api/v3/notifications/notifications_api.rb@@ -47,7 +47,7 @@ module API.recipient(current_user).includes(NotificationRepresenter.to_eager_load).where- .not(reason_ian: nil)+ .not(reason: nil)enddef bulk_update_status(attributes)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.rbindex d46e532c337..8afa054dc8e 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@@ -62,11 +62,8 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { joulet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :subscribed,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -116,11 +113,8 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { joulet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :subscribed,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endenddiff --git a/spec/contracts/notifications/create_contract_spec.rb b/spec/contracts/notifications/create_contract_spec.rbindex 323204f159f..47490a3af1e 100644--- a/spec/contracts/notifications/create_contract_spec.rb+++ b/spec/contracts/notifications/create_contract_spec.rb@@ -41,23 +41,17 @@ describe Notifications::CreateContract dolet(:notification_resource) { FactoryBot.build_stubbed(:journal) }let(:notification_recipient) { FactoryBot.build_stubbed(:user) }let(:notification_subject) { 'Some text' }- let(:notification_reason_ian) { :mentioned }- let(:notification_reason_mail) { :assigned }- let(:notification_reason_mail_digest) { :watched }+ let(:notification_reason) { :mentioned }let(:notification_read_ian) { false }- let(:notification_read_mail) { false }let(:notification_read_mail_digest) { false }let(:notification) doNotification.new(project: notification_context,recipient: notification_recipient,subject: notification_subject,- reason_ian: notification_reason_ian,- reason_mail: notification_reason_mail,- reason_mail_digest: notification_reason_mail_digest,+ reason: notification_reason,resource: notification_resource,read_ian: notification_read_ian,- read_mail: notification_read_mail,read_mail_digest: notification_read_mail_digest)end@@ -73,48 +67,19 @@ describe Notifications::CreateContract doendcontext 'without a reason for IAN with read_ian false' do- let(:notification_reason_ian) { nil }+ let(:notification_reason) { nil }let(:notification_read_ian) { false }- it_behaves_like 'contract is invalid', reason_ian: :no_notification_reason+ it_behaves_like 'contract is invalid', reason: :no_notification_reasonendcontext 'without a reason for IAN with read_ian nil' do- let(:notification_reason_ian) { nil }+ let(:notification_reason) { nil }let(:notification_read_ian) { nil }it_behaves_like 'contract is valid'end- context 'without a reason for mail with read_mail false' do- let(:notification_reason_mail) { nil }- let(:notification_read_mail) { false }-- it_behaves_like 'contract is invalid', reason_mail: :no_notification_reason- end-- context 'without a reason for mail with read_mail nil' do- let(:notification_reason_mail) { nil }- let(:notification_read_mail) { nil }-- it_behaves_like 'contract is valid'- end--- context 'without a reason for mail_digest with read_mail_digest false' do- let(:notification_reason_mail_digest) { nil }- let(:notification_read_mail_digest) { false }-- it_behaves_like 'contract is invalid', reason_mail_digest: :no_notification_reason- end-- context 'without a reason for mail_digest with read_mail_digest nil' do- let(:notification_reason_mail_digest) { nil }- let(:notification_read_mail_digest) { nil }-- it_behaves_like 'contract is valid'- end-context 'without a subject' dolet(:notification_subject) { nil }@@ -129,7 +94,6 @@ describe Notifications::CreateContract docontext 'with all channels nil' dolet(:notification_read_ian) { nil }- let(:notification_read_mail) { nil }let(:notification_read_mail_digest) { nil }it_behaves_like 'contract is invalid', base: :at_least_one_channel@@ -141,12 +105,6 @@ describe Notifications::CreateContract doit_behaves_like 'contract is invalid', read_ian: :read_on_creationend- context 'with read_mail true' do- let(:notification_read_mail) { true }-- it_behaves_like 'contract is invalid', read_mail: :read_on_creation- end-context 'with read_mail_digest true' dolet(:notification_read_mail_digest) { true }diff --git a/spec/factories/notification_factory.rb b/spec/factories/notification_factory.rbindex 12f084c5cc8..4f3a70ca2c2 100644--- a/spec/factories/notification_factory.rb+++ b/spec/factories/notification_factory.rb@@ -2,11 +2,8 @@ FactoryBot.define dofactory :notification dosubject { "MyText" } # rubocop:disable RSpec/EmptyLineAfterSubjectread_ian { false }- read_mail { false }read_mail_digest { false }- reason_ian { :mentioned }- reason_mail { :assigned }- reason_mail_digest { :watched }+ reason { :mentioned }recipient factory: :userproject { association :project }resource { association :work_package, project: project }diff --git a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rbindex 42358d79f9a..dd9367c9df2 100644--- a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb+++ b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb@@ -107,7 +107,7 @@ describe ::API::V3::Notifications::NotificationRepresenter, 'rendering' doendit_behaves_like 'property', :reason do- let(:value) { notification.reason_ian }+ let(:value) { notification.reason }endit_behaves_like 'datetime property', :createdAt dodiff --git a/spec/models/notifications/scopes/unread_mail_spec.rb b/spec/models/notifications/scopes/unread_mail_spec.rbdeleted file mode 100644index 7b3e5765216..00000000000--- a/spec/models/notifications/scopes/unread_mail_spec.rb+++ /dev/null@@ -1,50 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2021 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++--require 'spec_helper'--describe Notifications::Scopes::UnreadMail, type: :model do- describe '.unread_mail' do- subject(:scope) { ::Notification.unread_mail }-- let(:no_mail_notification) { FactoryBot.create(:notification, read_mail: nil) }- let(:unread_mail_notification) { FactoryBot.create(:notification, read_mail: false) }- let(:read_mail_notification) { FactoryBot.create(:notification, read_mail: true) }-- before do- no_mail_notification- unread_mail_notification- read_mail_notification- end-- it 'contains the notifications with read_mail: false' do- expect(scope)- .to match_array([unread_mail_notification])- end- end-enddiff --git a/spec/requests/api/v3/notifications/index_resource_spec.rb b/spec/requests/api/v3/notifications/index_resource_spec.rbindex 84000e8c919..9202ccf5b25 100644--- a/spec/requests/api/v3/notifications/index_resource_spec.rb+++ b/spec/requests/api/v3/notifications/index_resource_spec.rb@@ -82,7 +82,7 @@ describe ::API::V3::Notifications::NotificationsAPI,it_behaves_like 'API V3 collection response', 2, 2, 'Notification'context 'with a digest notification' do- let(:digest_notification) { FactoryBot.create :notification, recipient: recipient, reason_ian: nil }+ let(:digest_notification) { FactoryBot.create :notification, recipient: recipient, reason: nil }let(:notifications) { [notification1, notification2, digest_notification] }it_behaves_like 'API V3 collection response', 2, 2, 'Notification' dodiff --git a/spec/services/notifications/create_from_journal_job_shared.rb b/spec/services/notifications/create_from_journal_job_shared.rbindex 8a1e655bdb6..039b19da28e 100644--- a/spec/services/notifications/create_from_journal_job_shared.rb+++ b/spec/services/notifications/create_from_journal_job_shared.rb@@ -76,11 +76,8 @@ shared_context 'with CreateFromJournalJob context' dolet(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endlet(:notification) { FactoryBot.build_stubbed(:notification) }diff --git a/spec/services/notifications/create_from_model_service_comment_spec.rb b/spec/services/notifications/create_from_model_service_comment_spec.rbindex 511759b8f32..107f3caa30f 100644--- a/spec/services/notifications/create_from_model_service_comment_spec.rb+++ b/spec/services/notifications/create_from_model_service_comment_spec.rb@@ -67,11 +67,8 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :subscribed,+ reason: false,read_mail_digest: nil,- reason_mail_digest: false}endend@@ -118,11 +115,9 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,+ reason: false,read_mail: false,- reason_mail: :watched,read_mail_digest: nil,- reason_mail_digest: false}endenddiff --git a/spec/services/notifications/create_from_model_service_message_spec.rb b/spec/services/notifications/create_from_model_service_message_spec.rbindex 91ee3611bb3..8ffe66d718f 100644--- a/spec/services/notifications/create_from_model_service_message_spec.rb+++ b/spec/services/notifications/create_from_model_service_message_spec.rb@@ -68,11 +68,8 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :subscribed,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -119,11 +116,8 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :watched,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -174,11 +168,8 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :watched,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -220,11 +211,8 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :subscribed,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -271,11 +259,8 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :watched,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -326,11 +311,8 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jourlet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :watched,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endenddiff --git a/spec/services/notifications/create_from_model_service_news_spec.rb b/spec/services/notifications/create_from_model_service_news_spec.rbindex 95ea49e5e4a..57b9bed8b01 100644--- a/spec/services/notifications/create_from_model_service_news_spec.rb+++ b/spec/services/notifications/create_from_model_service_news_spec.rb@@ -60,11 +60,8 @@ describe Notifications::CreateFromModelService, 'news', with_settings: { journallet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :subscribed,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endenddiff --git a/spec/services/notifications/create_from_model_service_wiki_spec.rb b/spec/services/notifications/create_from_model_service_wiki_spec.rbindex ac824c8be8c..f2ac2f3b2aa 100644--- a/spec/services/notifications/create_from_model_service_wiki_spec.rb+++ b/spec/services/notifications/create_from_model_service_wiki_spec.rb@@ -66,11 +66,9 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journallet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,+ reason: false,read_mail: false,- reason_mail: :subscribed,- read_mail_digest: nil,- reason_mail_digest: false+ read_mail_digest: nil}endend@@ -117,11 +115,9 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journallet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,+ reason: false,read_mail: false,- reason_mail: :watched,- read_mail_digest: nil,- reason_mail_digest: false+ read_mail_digest: nil}endend@@ -173,11 +169,8 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journallet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :subscribed,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -224,11 +217,8 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journallet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :watched,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endend@@ -279,11 +269,8 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journallet(:notification_channel_reasons) do{read_ian: nil,- reason_ian: false,- read_mail: false,- reason_mail: :watched,- read_mail_digest: nil,- reason_mail_digest: false+ reason: false,+ read_mail_digest: nil}endenddiff --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 1641ed69df7..548fc12015f 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@@ -115,11 +115,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :assigned,- read_mail: false,- reason_mail: :assigned,- read_mail_digest: false,- reason_mail_digest: :assigned+ reason: :assigned,+ read_mail_digest: false}endend@@ -139,7 +136,7 @@ describe Notifications::CreateFromModelService,read_ian: nil,reason_ian: nil,read_mail: false,- reason_mail: :assigned,+ reason_mail: :involved,read_mail_digest: false,reason_mail_digest: :assigned}@@ -160,11 +157,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :assigned,- read_mail: nil,- reason_mail: nil,- read_mail_digest: nil,- reason_mail_digest: nil+ reason: :assigned,+ read_mail_digest: nil}endend@@ -195,11 +189,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :assigned,- read_mail: false,- reason_mail: :assigned,- read_mail_digest: false,- reason_mail_digest: :assigned+ reason: :assigned,+ read_mail_digest: false}endend@@ -245,11 +236,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :responsible,- read_mail: false,- reason_mail: :responsible,- read_mail_digest: false,- reason_mail_digest: :responsible+ reason: :responsible,+ read_mail_digest: false}endend@@ -267,11 +255,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: nil,- reason_ian: nil,- read_mail: nil,- reason_mail: nil,- read_mail_digest: false,- reason_mail_digest: :responsible+ reason: nil,+ read_mail_digest: false}endend@@ -290,11 +275,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :responsible,- read_mail: nil,- reason_mail: nil,- read_mail_digest: nil,- reason_mail_digest: nil+ reason: :responsible,+ read_mail_digest: nil}endend@@ -352,11 +334,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :watched,- read_mail: false,- reason_mail: :watched,- read_mail_digest: false,- reason_mail_digest: :watched+ reason: :watched,+ read_mail_digest: false}endend@@ -374,11 +353,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: nil,- reason_ian: nil,- read_mail: false,- reason_mail: :watched,- read_mail_digest: false,- reason_mail_digest: :watched+ reason: nil,+ read_mail_digest: false}endend@@ -397,11 +373,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :watched,- read_mail: nil,- reason_mail: nil,- read_mail_digest: nil,- reason_mail_digest: nil+ reason: :watched,+ read_mail_digest: nil}endend@@ -454,11 +427,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :created,- read_mail: false,- reason_mail: :created,- read_mail_digest: false,- reason_mail_digest: :created+ reason: :subscribed,+ read_mail_digest: false}endend@@ -476,11 +446,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: nil,- reason_ian: nil,- read_mail: false,- reason_mail: :created,- read_mail_digest: false,- reason_mail_digest: :created+ reason: nil,+ read_mail_digest: false}endend@@ -499,11 +466,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :created,- read_mail: nil,- reason_mail: nil,- read_mail_digest: nil,- reason_mail_digest: nil+ reason: :created,+ read_mail_digest: nil}endend@@ -537,11 +501,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :created,- read_mail: false,- reason_mail: :created,- read_mail_digest: false,- reason_mail_digest: :created+ reason: :subscribed,+ read_mail_digest: false}endend@@ -599,11 +560,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :created,- read_mail: false,- reason_mail: :created,- read_mail_digest: false,- reason_mail_digest: :created+ reason: :created,+ read_mail_digest: false}endend@@ -671,11 +629,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :commented,- read_mail: false,- reason_mail: :commented,- read_mail_digest: false,- reason_mail_digest: :commented+ reason: :commented,+ read_mail_digest: false}endend@@ -732,11 +687,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :processed,- read_mail: false,- reason_mail: :processed,- read_mail_digest: false,- reason_mail_digest: :processed+ reason: :processed,+ read_mail_digest: false}endend@@ -793,11 +745,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :prioritized,- read_mail: false,- reason_mail: :prioritized,- read_mail_digest: false,- reason_mail_digest: :prioritized+ reason: :prioritized,+ read_mail_digest: false}endend@@ -854,11 +803,9 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :scheduled,+ reason: :scheduled,read_mail: false,- reason_mail: :scheduled,- read_mail_digest: false,- reason_mail_digest: :scheduled+ read_mail_digest: false}endend@@ -915,11 +862,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :scheduled,- read_mail: false,- reason_mail: :scheduled,- read_mail_digest: false,- reason_mail_digest: :scheduled+ reason: :scheduled,+ read_mail_digest: false}endend@@ -952,11 +896,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :assigned,- read_mail: false,- reason_mail: :assigned,- read_mail_digest: false,- reason_mail_digest: :assigned+ reason: :assigned,+ read_mail_digest: false}endend@@ -978,11 +919,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endend@@ -1014,11 +952,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endend@@ -1035,11 +970,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endend@@ -1053,11 +985,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endend@@ -1070,11 +999,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endend@@ -1091,11 +1017,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endend@@ -1112,11 +1035,8 @@ describe Notifications::CreateFromModelService,let(:notification_channel_reasons) do{read_ian: false,- reason_ian: :mentioned,- read_mail: false,- reason_mail: :mentioned,- read_mail_digest: false,- reason_mail_digest: :mentioned+ reason: :mentioned,+ read_mail_digest: false}endenddiff --git a/spec/services/notifications/set_attributes_service_spec.rb b/spec/services/notifications/set_attributes_service_spec.rbindex 20890bb3f86..a22cd2b74ef 100644--- a/spec/services/notifications/set_attributes_service_spec.rb+++ b/spec/services/notifications/set_attributes_service_spec.rb@@ -58,9 +58,7 @@ describe Notifications::SetAttributesService, type: :model doendlet(:call_attributes) { {} }let(:project) { FactoryBot.build_stubbed(:project) }- let(:reason_ian) { :mentioned }- let(:reason_mail) { :assigned }- let(:reason_mail_digest) { :watched }+ let(:reason) { :mentioned }let(:journal) { FactoryBot.build_stubbed(:journal, journable: journable, data: journal_data) }let(:journable) { nil }let(:journal_data) { nil }@@ -71,9 +69,7 @@ describe Notifications::SetAttributesService, type: :model dolet(:call_attributes) do{recipient_id: recipient_id,- reason_ian: reason_ian,- reason_mail: reason_mail,- reason_mail_digest: reason_mail_digest,+ reason: reason,resource: journable,journal: journal,subject: event_subject,@@ -99,14 +95,11 @@ describe Notifications::SetAttributesService, type: :model doexpect(event.attributes.compact.symbolize_keys).to eql({project_id: project.id,- reason_ian: 'mentioned',- reason_mail: 'assigned',- reason_mail_digest: 'watched',+ reason: 'mentioned',journal_id: journal.id,recipient_id: 1,subject: event_subject,read_ian: false,- read_mail: false,read_mail_digest: false})end@@ -125,9 +118,7 @@ describe Notifications::SetAttributesService, type: :model dolet(:call_attributes) do{recipient_id: recipient_id,- reason_ian: reason_ian,- reason_mail: reason_mail,- reason_mail_digest: reason_mail_digest,+ reason: reason,journal: journal,resource: journable,}@@ -139,15 +130,12 @@ describe Notifications::SetAttributesService, type: :model doexpect(event.attributes.compact.symbolize_keys).to eql({project_id: project.id,- reason_ian: 'mentioned',- reason_mail: 'assigned',- reason_mail_digest: 'watched',+ reason: 'mentioned',resource_id: journable.id,resource_type: 'WorkPackage',journal_id: journal.id,recipient_id: 1,read_ian: false,- read_mail: false,read_mail_digest: false})end