Skip to content

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

Rename read_mail_digest into sent_mail and merge with non-wp items

Oliver Günther5b8df97498f8
diff --git a/app/contracts/notifications/create_contract.rb b/app/contracts/notifications/create_contract.rb
index 154cb51b741..3d57260fd00 100644
--- a/app/contracts/notifications/create_contract.rb
+++ b/app/contracts/notifications/create_contract.rb
@@ -37,7 +37,7 @@ module Notifications
attribute :journal
attribute :resource_type
attribute :read_ian
- attribute :read_mail_digest
+ attribute :sent_mail
validate :validate_recipient_present
validate :validate_reason_present
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 16b2cd11429..2502d3a83ad 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -22,6 +22,6 @@ class Notification < ApplicationRecord
include Scopes::Scoped
scopes :unsent_reminders_before,
- :unread_mail_digest,
+ :unsent_mail,
:recipient
end
diff --git a/app/models/notifications/scopes/unread_mail_digest.rb b/app/models/notifications/scopes/unread_mail_digest.rb
index a439b9091e1..6f61be2f085 100644
--- a/app/models/notifications/scopes/unread_mail_digest.rb
+++ b/app/models/notifications/scopes/unread_mail_digest.rb
@@ -34,8 +34,8 @@ module Notifications::Scopes
extend ActiveSupport::Concern
class_methods do
- def unread_mail_digest
- where(read_mail_digest: false)
+ def unsent_mail
+ where(sent_mail: false)
end
end
end
diff --git a/app/models/notifications/scopes/unsent_reminders_before.rb b/app/models/notifications/scopes/unsent_reminders_before.rb
index 3456752ee70..1355f9d79f1 100644
--- a/app/models/notifications/scopes/unsent_reminders_before.rb
+++ b/app/models/notifications/scopes/unsent_reminders_before.rb
@@ -39,7 +39,7 @@ module Notifications::Scopes
where(Notification.arel_table[:created_at].lteq(time))
.where(recipient: recipient)
.where("read_ian IS NULL OR read_ian IS FALSE")
- .where(read_mail_digest: false)
+ .where(sent_mail: false)
end
end
end
diff --git a/app/services/notifications/create_from_model_service.rb b/app/services/notifications/create_from_model_service.rb
index fbd2cbb9d66..dc88413ab81 100644
--- a/app/services/notifications/create_from_model_service.rb
+++ b/app/services/notifications/create_from_model_service.rb
@@ -78,7 +78,7 @@ class Notifications::CreateFromModelService
{
reason: strategy.supports_ian? && channel_reasons['in_app']&.first,
read_ian: strategy.supports_ian? && channel_reasons.keys.include?('in_app') ? false : nil,
- read_mail_digest: strategy.supports_mail_digest? && channel_reasons.keys.include?('mail_digest') ? false : nil
+ sent_mail: strategy.supports_mail_digest? && channel_reasons.keys.include?('mail_digest') ? false : nil
}
end
diff --git a/app/services/notifications/mail_service.rb b/app/services/notifications/mail_service.rb
index 4255742cac5..095cfa11b06 100644
--- a/app/services/notifications/mail_service.rb
+++ b/app/services/notifications/mail_service.rb
@@ -26,45 +26,51 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Notifications::MailService
- def initialize(notification)
- self.notification = notification
- end
+module Notifications
+ class MailService
+ include WithMarkedNotifications
- def call
- return unless supported?
- return if ian_read?
+ def initialize(notification)
+ self.notification = notification
+ end
- strategy.send_mail(notification)
- end
+ def call
+ return unless supported?
+ return if ian_read?
- private
+ with_marked_notifications(notification.id) do
+ strategy.send_mail(notification)
+ end
+ end
- attr_accessor :notification
+ private
- def ian_read?
- notification.read_ian
- end
+ attr_accessor :notification
- def strategy
- @strategy ||= if self.class.const_defined?("#{strategy_model}Strategy")
- "#{self.class}::#{strategy_model}Strategy".constantize
- end
- end
+ def ian_read?
+ notification.read_ian
+ end
- def strategy_model
- journal&.journable_type || resource&.class
- end
+ def strategy
+ @strategy ||= if self.class.const_defined?("#{strategy_model}Strategy")
+ "#{self.class}::#{strategy_model}Strategy".constantize
+ end
+ end
- def journal
- notification.journal
- end
+ def strategy_model
+ journal&.journable_type || resource&.class
+ end
- def resource
- notification.resource
- end
+ def journal
+ notification.journal
+ end
+
+ def resource
+ notification.resource
+ end
- def supported?
- strategy.present?
+ def supported?
+ strategy.present?
+ end
end
end
diff --git a/app/workers/mails/reminder_job.rb b/app/workers/mails/reminder_job.rb
index fce4238e780..f9abbd2efd5 100644
--- a/app/workers/mails/reminder_job.rb
+++ b/app/workers/mails/reminder_job.rb
@@ -29,6 +29,8 @@
#++
class Mails::ReminderJob < Mails::DeliverJob
+ include ::Notifications::WithMarkedNotifications
+
private
def render_mail
@@ -46,8 +48,8 @@ class Mails::ReminderJob < Mails::DeliverJob
# Running the digest job will take some time to complete.
# Within this timeframe, new notifications might come in. Upon notification creation
- # a job is scheduled unless there is no prior digest notification that is not yet read (read_mail_digest: true).
- # If we were to only set the read_mail_digest state at the end of the mail rendering an edge case of the following
+ # a job is scheduled unless there is no prior digest notification that is not yet read (sent_mail: true).
+ # If we were to only set the sent_mail state at the end of the mail rendering an edge case of the following
# would lead to digest not being sent or at least sent unduly late:
# * Job starts and fetches the notifications for rendering. We need to fetch all notifications to be rendered to
# order them as desired.
@@ -58,18 +60,4 @@ class Mails::ReminderJob < Mails::DeliverJob
#
# A new job would then only be scheduled upon the creation of a new digest notification which (as unlikely as that is)
# might only happen after some days have gone by.
- #
- # Because we mark the notifications as read even though they in fact aren't, we do it in a transaction
- # so that the change is rolled back in case of an error.
- def with_marked_notifications(notification_ids)
- Notification.transaction do
- mark_notifications_read(notification_ids)
-
- yield
- end
- end
-
- def mark_notifications_read(notification_ids)
- Notification.where(id: notification_ids).update_all(read_mail_digest: true, updated_at: Time.current)
- end
end
diff --git a/app/workers/notifications/with_marked_notifications.rb b/app/workers/notifications/with_marked_notifications.rb
new file mode 100644
index 00000000000..4fdf34f046a
--- /dev/null
+++ b/app/workers/notifications/with_marked_notifications.rb
@@ -0,0 +1,53 @@
+#-- 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.
+#++
+
+# Because we mark the notifications as read even though they in fact aren't, we do it in a transaction
+# so that the change is rolled back in case of an error.
+module Notifications
+ module WithMarkedNotifications
+ extend ActiveSupport::Concern
+
+ included do
+ private
+
+ def with_marked_notifications(notification_ids)
+ Notification.transaction do
+ mark_notifications_sent(notification_ids)
+
+ yield
+ end
+ end
+
+ def mark_notifications_sent(notification_ids)
+ Notification.where(id: Array(notification_ids)).update_all(sent_mail: true, updated_at: Time.current)
+ end
+ end
+ end
+end
diff --git a/app/workers/notifications/workflow_job.rb b/app/workers/notifications/workflow_job.rb
index 78db85ac638..e5f9aa08ba7 100644
--- a/app/workers/notifications/workflow_job.rb
+++ b/app/workers/notifications/workflow_job.rb
@@ -63,22 +63,15 @@ class Notifications::WorkflowJob < ApplicationJob
wait: -> { Setting.journal_aggregation_time_minutes.to_i.minutes } do |*notification_ids|
next unless notification_ids
- Notification
- .where(id: notification_ids)
- .where(reason: NotificationSetting.mail_reasons)
- .each do |notification|
- Notifications::MailService
- .new(notification)
- .call
- end
-
Notification
.where(id: notification_ids)
- .unread_mail # TODO
+ .unsent_mail
+ .where(reason: NotificationSetting.mail_reasons)
.each do |notification|
Notifications::MailService
.new(notification)
.call
end
+ end
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index c6d4051d537..62411929788 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -686,7 +686,7 @@ en:
attributes:
read_ian:
read_on_creation: 'cannot be set to true on notification creation.'
- read_mail_digest:
+ sent_mail:
read_on_creation: 'cannot be set to true on notification creation.'
reason:
no_notification_reason: 'cannot be blank as IAN is chosen as a channel.'
diff --git a/db/migrate/20210914065555_cleanup_notifications.rb b/db/migrate/20210914065555_cleanup_notifications.rb
index 7ae9a480cf0..80385d60239 100644
--- a/db/migrate/20210914065555_cleanup_notifications.rb
+++ b/db/migrate/20210914065555_cleanup_notifications.rb
@@ -3,6 +3,7 @@ class CleanupNotifications < ActiveRecord::Migration[6.1]
change_table :notifications, bulk: true do |t|
t.remove :read_mail, :reason_mail, :reason_mail_digest
t.rename :reason_ian, :reason
+ t.rename :read_mail_digest, :sent_mail
end
change_table :notification_settings, bulk: true do |t|
@@ -31,6 +32,7 @@ class CleanupNotifications < ActiveRecord::Migration[6.1]
t.boolean :read_mail, default: false, index: true
t.integer :reason_mail, limit: 1
t.integer :reason_mail_digest, limit: 1
+ t.rename :sent_mail, :read_mail_digest
t.rename :reason, :reason_ian
end
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 8afa054dc8e..f635c668690 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
@@ -63,7 +63,7 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -114,7 +114,7 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
diff --git a/spec/contracts/notifications/create_contract_spec.rb b/spec/contracts/notifications/create_contract_spec.rb
index 3cb5db3292b..20aa4f6d69a 100644
--- a/spec/contracts/notifications/create_contract_spec.rb
+++ b/spec/contracts/notifications/create_contract_spec.rb
@@ -43,7 +43,7 @@ describe Notifications::CreateContract do
let(:notification_subject) { 'Some text' }
let(:notification_reason) { :mentioned }
let(:notification_read_ian) { false }
- let(:notification_read_mail_digest) { false }
+ let(:notification_sent_mail) { false }
let(:notification) do
Notification.new(project: notification_context,
@@ -52,7 +52,7 @@ describe Notifications::CreateContract do
reason: notification_reason,
resource: notification_resource,
read_ian: notification_read_ian,
- read_mail_digest: notification_read_mail_digest)
+ sent_mail: notification_sent_mail)
end
let(:contract) { described_class.new(notification, current_user) }
@@ -98,10 +98,10 @@ describe Notifications::CreateContract do
it_behaves_like 'contract is invalid', read_ian: :read_on_creation
end
- context 'with read_mail_digest true' do
- let(:notification_read_mail_digest) { true }
+ context 'with sent_mail true' do
+ let(:notification_sent_mail) { true }
- it_behaves_like 'contract is invalid', read_mail_digest: :read_on_creation
+ it_behaves_like 'contract is invalid', sent_mail: :read_on_creation
end
end
end
diff --git a/spec/factories/notification_factory.rb b/spec/factories/notification_factory.rb
index 4f3a70ca2c2..6867fe2624d 100644
--- a/spec/factories/notification_factory.rb
+++ b/spec/factories/notification_factory.rb
@@ -2,7 +2,7 @@ FactoryBot.define do
factory :notification do
subject { "MyText" } # rubocop:disable RSpec/EmptyLineAfterSubject
read_ian { false }
- read_mail_digest { false }
+ sent_mail { false }
reason { :mentioned }
recipient factory: :user
project { association :project }
diff --git a/spec/models/notifications/scopes/unread_mail_digest_spec.rb b/spec/models/notifications/scopes/unread_mail_digest_spec.rb
index b706e8761a9..851f06fa60e 100644
--- a/spec/models/notifications/scopes/unread_mail_digest_spec.rb
+++ b/spec/models/notifications/scopes/unread_mail_digest_spec.rb
@@ -30,11 +30,11 @@ require 'spec_helper'
describe Notifications::Scopes::UnreadMailDigest, type: :model do
describe '.unread_digest_mail' do
- subject(:scope) { ::Notification.unread_mail_digest }
+ subject(:scope) { ::Notification.unsent_mail }
- let(:no_mail_notification) { FactoryBot.create(:notification, read_mail_digest: nil) }
- let(:unread_mail_notification) { FactoryBot.create(:notification, read_mail_digest: false) }
- let(:read_mail_notification) { FactoryBot.create(:notification, read_mail_digest: true) }
+ let(:no_mail_notification) { FactoryBot.create(:notification, sent_mail: nil) }
+ let(:unread_mail_notification) { FactoryBot.create(:notification, sent_mail: false) }
+ let(:read_mail_notification) { FactoryBot.create(:notification, sent_mail: true) }
before do
no_mail_notification
diff --git a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb b/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
index 10ca824c94f..410998bcf3b 100644
--- a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
+++ b/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
@@ -42,11 +42,10 @@ describe Notifications::Scopes::UnsentRemindersBefore, type: :model do
let(:notification) do
FactoryBot.create(:notification,
recipient: notification_recipient,
- read_ian: notification_read_ian,
- read_mail_digest: notification_read_mail_digest,
+ sent_mail: notification_sent_mail,
created_at: notification_created_at)
end
- let(:notification_read_mail_digest) { false }
+ let(:notification_sent_mail) { false }
let(:notification_read_ian) { false }
let(:notification_created_at) { Time.current - 10.minutes }
let(:notification_recipient) { recipient }
@@ -80,13 +79,13 @@ describe Notifications::Scopes::UnsentRemindersBefore, type: :model do
end
context 'with a unread and not reminded notification created before the time and for the user' do
- let(:notification_read_mail_digest) { nil }
+ let(:notification_sent_mail) { nil }
it_behaves_like 'is empty'
end
context 'with a unread but reminded notification created before the time and for the user' do
- let(:notification_read_mail_digest) { true }
+ let(:notification_sent_mail) { true }
it_behaves_like 'is empty'
end
diff --git a/spec/services/notifications/create_from_journal_job_shared.rb b/spec/services/notifications/create_from_journal_job_shared.rb
index d4fca20734c..7772d25cf4f 100644
--- a/spec/services/notifications/create_from_journal_job_shared.rb
+++ b/spec/services/notifications/create_from_journal_job_shared.rb
@@ -77,7 +77,7 @@ shared_context 'with CreateFromJournalJob context' do
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
let(: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.rb
index 36c4d605802..f8760a01247 100644
--- a/spec/services/notifications/create_from_model_service_comment_spec.rb
+++ b/spec/services/notifications/create_from_model_service_comment_spec.rb
@@ -68,7 +68,7 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jour
{
read_ian: nil,
reason: false,
- read_mail_digest: nil,
+ sent_mail: nil,
}
end
end
@@ -111,7 +111,7 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jour
read_ian: nil,
reason: false,
read_mail: false,
- read_mail_digest: nil,
+ sent_mail: nil,
}
end
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 e9582c83e07..6cd6317e6b9 100644
--- a/spec/services/notifications/create_from_model_service_message_spec.rb
+++ b/spec/services/notifications/create_from_model_service_message_spec.rb
@@ -69,7 +69,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -111,7 +111,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -157,7 +157,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -198,7 +198,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -240,7 +240,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -286,7 +286,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
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 2321d2a0517..8f49c4e69af 100644
--- a/spec/services/notifications/create_from_model_service_news_spec.rb
+++ b/spec/services/notifications/create_from_model_service_news_spec.rb
@@ -61,7 +61,7 @@ describe Notifications::CreateFromModelService, 'news', with_settings: { journal
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
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 f2ac2f3b2aa..7cdec03710e 100644
--- a/spec/services/notifications/create_from_model_service_wiki_spec.rb
+++ b/spec/services/notifications/create_from_model_service_wiki_spec.rb
@@ -68,7 +68,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
read_ian: nil,
reason: false,
read_mail: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -117,7 +117,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
read_ian: nil,
reason: false,
read_mail: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -170,7 +170,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -218,7 +218,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -270,7 +270,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
{
read_ian: nil,
reason: false,
- read_mail_digest: nil
+ sent_mail: nil
}
end
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 548fc12015f..fdfe013d237 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
@@ -116,7 +116,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -134,11 +134,8 @@ describe Notifications::CreateFromModelService,
let(:notification_channel_reasons) do
{
read_ian: nil,
- reason_ian: nil,
- read_mail: false,
- reason_mail: :involved,
- read_mail_digest: false,
- reason_mail_digest: :assigned
+ reason: nil,
+ sent_mail: false
}
end
end
@@ -158,7 +155,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -190,7 +187,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -237,7 +234,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :responsible,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -256,7 +253,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: nil,
reason: nil,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -276,7 +273,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :responsible,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -335,7 +332,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :watched,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -354,7 +351,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: nil,
reason: nil,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -374,7 +371,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :watched,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -428,7 +425,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :subscribed,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -447,7 +444,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: nil,
reason: nil,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -467,7 +464,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :created,
- read_mail_digest: nil
+ sent_mail: nil
}
end
end
@@ -502,7 +499,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :subscribed,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -561,7 +558,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :created,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -630,7 +627,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :commented,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -688,7 +685,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :processed,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -746,7 +743,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :prioritized,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -805,7 +802,7 @@ describe Notifications::CreateFromModelService,
read_ian: false,
reason: :scheduled,
read_mail: false,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -863,7 +860,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :scheduled,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -897,7 +894,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -920,7 +917,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -953,7 +950,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -971,7 +968,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -986,7 +983,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -1000,7 +997,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -1018,7 +1015,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
@@ -1036,7 +1033,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- read_mail_digest: false
+ sent_mail: false
}
end
end
diff --git a/spec/services/notifications/set_attributes_service_spec.rb b/spec/services/notifications/set_attributes_service_spec.rb
index a22cd2b74ef..80bc335de58 100644
--- a/spec/services/notifications/set_attributes_service_spec.rb
+++ b/spec/services/notifications/set_attributes_service_spec.rb
@@ -100,7 +100,7 @@ describe Notifications::SetAttributesService, type: :model do
recipient_id: 1,
subject: event_subject,
read_ian: false,
- read_mail_digest: false
+ sent_mail: false
})
end
@@ -136,7 +136,7 @@ describe Notifications::SetAttributesService, type: :model do
journal_id: journal.id,
recipient_id: 1,
read_ian: false,
- read_mail_digest: false
+ sent_mail: false
})
end
end
diff --git a/spec/workers/mails/reminder_job_spec.rb b/spec/workers/mails/reminder_job_spec.rb
index 2f7fd3d1dda..7d410e1c5d0 100644
--- a/spec/workers/mails/reminder_job_spec.rb
+++ b/spec/workers/mails/reminder_job_spec.rb
@@ -89,7 +89,7 @@ describe Mails::ReminderJob, type: :model do
expect(notifications)
.to have_received(:update_all)
- .with(read_mail_digest: true, updated_at: Time.current)
+ .with(sent_mail: true, updated_at: Time.current)
end
it 'impersonates the recipient' do