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

Strip sent_mail into two columns mail_alert_sent and mail_reminder_sent

Oliver Günther528ca50faa16
diff --git a/app/contracts/notifications/create_contract.rb b/app/contracts/notifications/create_contract.rb
index 4a370888222..3211d0fd119 100644
--- a/app/contracts/notifications/create_contract.rb
+++ b/app/contracts/notifications/create_contract.rb
@@ -37,7 +37,8 @@ module Notifications
attribute :journal
attribute :resource_type
attribute :read_ian
- attribute :sent_mail
+ attribute :mail_reminder_sent
+ attribute :mail_alert_sent
validate :validate_recipient_present
validate :validate_reason_present
@@ -49,7 +50,8 @@ module Notifications
end
def validate_sent
- errors.add(:sent_mail, :set_on_creation) if model.sent_mail
+ errors.add(:mail_reminder_sent, :set_on_creation) if model.mail_reminder_sent
+ errors.add(:mail_alert_sent, :set_on_creation) if model.mail_alert_sent
end
def validate_recipient_present
diff --git a/app/models/notification.rb b/app/models/notification.rb
index b3d39d32fe9..729264d6cad 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -23,6 +23,7 @@ class Notification < ApplicationRecord
include Scopes::Scoped
scopes :unsent_reminders_before,
- :unsent_mail,
+ :mail_reminder_unsent,
+ :mail_alert_unsent,
:recipient
end
diff --git a/app/models/notifications/scopes/mail_alert_unsent.rb b/app/models/notifications/scopes/mail_alert_unsent.rb
new file mode 100644
index 00000000000..277d014b50e
--- /dev/null
+++ b/app/models/notifications/scopes/mail_alert_unsent.rb
@@ -0,0 +1,42 @@
+#-- 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 alert mail notifications that are unread (have mail_alert_sent: false)
+module Notifications::Scopes
+ module MailAlertUnsent
+ extend ActiveSupport::Concern
+
+ class_methods do
+ def mail_alert_unsent
+ where(mail_alert_unsent: false)
+ end
+ end
+ end
+end
diff --git a/app/models/notifications/scopes/unsent_mail.rb b/app/models/notifications/scopes/mail_reminder_unsent.rb
similarity index 93%
rename from app/models/notifications/scopes/unsent_mail.rb
rename to app/models/notifications/scopes/mail_reminder_unsent.rb
index a1d422938cf..c35daf0963b 100644
--- a/app/models/notifications/scopes/unsent_mail.rb
+++ b/app/models/notifications/scopes/mail_reminder_unsent.rb
@@ -30,12 +30,12 @@
# Return digest mail notifications that are unread (have read_digest_mail: false)
module Notifications::Scopes
- module UnsentMail
+ module MailReminderUnsent
extend ActiveSupport::Concern
class_methods do
- def unsent_mail
- where(sent_mail: false)
+ def mail_reminder_unsent
+ where(mail_reminder_sent: 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 1355f9d79f1..d557eb9fd03 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(sent_mail: false)
+ .where(mail_reminder_sent: 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 344b3e74364..474d845a000 100644
--- a/app/services/notifications/create_from_model_service.rb
+++ b/app/services/notifications/create_from_model_service.rb
@@ -69,7 +69,7 @@ class Notifications::CreateFromModelService
actor: user_with_fallback,
reason: reasons.first,
read_ian: false,
- sent_mail: false
+ mail_reminder_sent: false
}
Notifications::CreateService
diff --git a/app/services/notifications/mail_service.rb b/app/services/notifications/mail_service.rb
index 095cfa11b06..5d5461bcc84 100644
--- a/app/services/notifications/mail_service.rb
+++ b/app/services/notifications/mail_service.rb
@@ -72,5 +72,9 @@ module Notifications
def supported?
strategy.present?
end
+
+ def notification_marked_attribute
+ :mail_alert_sent
+ end
end
end
diff --git a/app/workers/mails/reminder_job.rb b/app/workers/mails/reminder_job.rb
index f9abbd2efd5..fb3d39b6348 100644
--- a/app/workers/mails/reminder_job.rb
+++ b/app/workers/mails/reminder_job.rb
@@ -33,6 +33,10 @@ class Mails::ReminderJob < Mails::DeliverJob
private
+ def notification_marked_attribute
+ :mail_reminder_sent
+ end
+
def render_mail
# Have to cast to array since the update in the subsequent block
# will result in the notification to not be found via the .unsent_reminders_before scope.
@@ -48,8 +52,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 (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
+ # a job is scheduled unless there is no prior digest notification that is not yet read (mail_reminder_sent: true).
+ # If we were to only set the mail_reminder_sent 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.
diff --git a/app/workers/notifications/with_marked_notifications.rb b/app/workers/notifications/with_marked_notifications.rb
index 4fdf34f046a..dfa6eec51fe 100644
--- a/app/workers/notifications/with_marked_notifications.rb
+++ b/app/workers/notifications/with_marked_notifications.rb
@@ -46,7 +46,9 @@ module Notifications
end
def mark_notifications_sent(notification_ids)
- Notification.where(id: Array(notification_ids)).update_all(sent_mail: true, updated_at: Time.current)
+ Notification
+ .where(id: Array(notification_ids))
+ .update_all(notification_marked_attribute => true, updated_at: Time.current)
end
end
end
diff --git a/app/workers/notifications/workflow_job.rb b/app/workers/notifications/workflow_job.rb
index 67775f28419..dcb983dd2c0 100644
--- a/app/workers/notifications/workflow_job.rb
+++ b/app/workers/notifications/workflow_job.rb
@@ -65,8 +65,7 @@ class Notifications::WorkflowJob < ApplicationJob
Notification
.where(id: notification_ids)
- .unsent_mail
- .where(reason: NotificationSetting.email_settings)
+ .mail_alert_unsent
.each do |notification|
Notifications::MailService
.new(notification)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index dfd43eb43bb..0c4680fb838 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.'
- sent_mail:
+ mail_reminder_sent:
set_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 f1db1151997..e1a15b44416 100644
--- a/db/migrate/20210914065555_cleanup_notifications.rb
+++ b/db/migrate/20210914065555_cleanup_notifications.rb
@@ -3,7 +3,8 @@ 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
+ t.rename :read_mail_digest, :mail_reminder_sent
+ t.boolean :mail_alert_sent, default: nil, index: true
end
change_table :notification_settings, bulk: true do |t|
@@ -33,7 +34,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 :mail_reminder_sent, :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 9a77006ad44..20450e8d44d 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,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -110,7 +110,7 @@ describe Notifications::CreateFromModelService, 'document', with_settings: { jou
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
diff --git a/spec/contracts/notifications/create_contract_spec.rb b/spec/contracts/notifications/create_contract_spec.rb
index afb0ec4f062..9c3e69d99b5 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_sent_mail) { false }
+ let(:notification_mail_reminder_sent) { 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,
- sent_mail: notification_sent_mail)
+ mail_reminder_sent: notification_mail_reminder_sent)
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 sent_mail true' do
- let(:notification_sent_mail) { true }
+ context 'with mail_reminder_sent true' do
+ let(:notification_mail_reminder_sent) { true }
- it_behaves_like 'contract is invalid', sent_mail: :set_on_creation
+ it_behaves_like 'contract is invalid', mail_reminder_sent: :set_on_creation
end
end
end
diff --git a/spec/factories/notification_factory.rb b/spec/factories/notification_factory.rb
index 6867fe2624d..0b2164539c4 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 }
- sent_mail { false }
+ mail_reminder_sent { 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/reminder_mail_unsent.rb
similarity index 88%
rename from spec/models/notifications/scopes/unread_mail_digest_spec.rb
rename to spec/models/notifications/scopes/reminder_mail_unsent.rb
index 851f06fa60e..d7ebb805039 100644
--- a/spec/models/notifications/scopes/unread_mail_digest_spec.rb
+++ b/spec/models/notifications/scopes/reminder_mail_unsent.rb
@@ -28,13 +28,13 @@
require 'spec_helper'
-describe Notifications::Scopes::UnreadMailDigest, type: :model do
+describe Notifications::Scopes::MailReminderUnsent, type: :model do
describe '.unread_digest_mail' do
- subject(:scope) { ::Notification.unsent_mail }
+ subject(:scope) { ::Notification.mail_reminder_unsent }
- 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) }
+ let(:no_mail_notification) { FactoryBot.create(:notification, mail_reminder_sent: nil) }
+ let(:unread_mail_notification) { FactoryBot.create(:notification, mail_reminder_sent: false) }
+ let(:read_mail_notification) { FactoryBot.create(:notification, mail_reminder_sent: 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 410998bcf3b..c4bbe9c5b63 100644
--- a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
+++ b/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
@@ -42,10 +42,10 @@ describe Notifications::Scopes::UnsentRemindersBefore, type: :model do
let(:notification) do
FactoryBot.create(:notification,
recipient: notification_recipient,
- sent_mail: notification_sent_mail,
+ mail_reminder_sent: notification_mail_reminder_sent,
created_at: notification_created_at)
end
- let(:notification_sent_mail) { false }
+ let(:notification_mail_reminder_sent) { false }
let(:notification_read_ian) { false }
let(:notification_created_at) { Time.current - 10.minutes }
let(:notification_recipient) { recipient }
@@ -79,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_sent_mail) { nil }
+ let(:notification_mail_reminder_sent) { 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_sent_mail) { true }
+ let(:notification_mail_reminder_sent) { 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 41df103a6cc..9f7adbb0b59 100644
--- a/spec/services/notifications/create_from_journal_job_shared.rb
+++ b/spec/services/notifications/create_from_journal_job_shared.rb
@@ -73,7 +73,7 @@ shared_context 'with CreateFromJournalJob context' do
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: 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 67c5f23c43a..afca64d0191 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,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -111,7 +111,7 @@ describe Notifications::CreateFromModelService, 'comment', with_settings: { jour
read_ian: nil,
reason: false,
read_mail: false,
- sent_mail: nil
+ mail_reminder_sent: 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 6cd6317e6b9..3700b3dee12 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,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -111,7 +111,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -157,7 +157,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -198,7 +198,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -240,7 +240,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -286,7 +286,7 @@ describe Notifications::CreateFromModelService, 'message', with_settings: { jour
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: 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 8f49c4e69af..b37b321c451 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,
- sent_mail: nil
+ mail_reminder_sent: 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 20ccde1de25..d6a758ce080 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,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -111,7 +111,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
read_ian: nil,
reason: false,
read_mail: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -160,7 +160,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -202,7 +202,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -248,7 +248,7 @@ describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal
{
read_ian: nil,
reason: false,
- sent_mail: nil
+ mail_reminder_sent: 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 1ef1ee71efa..1aa3cf48fba 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
@@ -114,7 +114,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -131,7 +131,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: nil,
reason: nil,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -149,7 +149,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -177,7 +177,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -220,7 +220,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :responsible,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -237,7 +237,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: nil,
reason: nil,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -255,7 +255,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :responsible,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -308,7 +308,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :watched,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -325,7 +325,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: nil,
reason: nil,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -343,7 +343,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :watched,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -391,7 +391,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :subscribed,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -408,7 +408,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: nil,
reason: nil,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -426,7 +426,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :created,
- sent_mail: nil
+ mail_reminder_sent: nil
}
end
end
@@ -455,7 +455,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :subscribed,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -504,7 +504,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :created,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -559,7 +559,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :commented,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -607,7 +607,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :processed,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -655,7 +655,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :prioritized,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -704,7 +704,7 @@ describe Notifications::CreateFromModelService,
read_ian: false,
reason: :scheduled,
read_mail: false,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -752,7 +752,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :scheduled,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -784,7 +784,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :assigned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -805,7 +805,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -836,7 +836,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -854,7 +854,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -869,7 +869,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -883,7 +883,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -901,7 +901,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
@@ -919,7 +919,7 @@ describe Notifications::CreateFromModelService,
{
read_ian: false,
reason: :mentioned,
- sent_mail: false
+ mail_reminder_sent: false
}
end
end
diff --git a/spec/services/notifications/set_attributes_service_spec.rb b/spec/services/notifications/set_attributes_service_spec.rb
index 80bc335de58..ed973871735 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,
- sent_mail: false
+ mail_reminder_sent: false
})
end
@@ -136,7 +136,7 @@ describe Notifications::SetAttributesService, type: :model do
journal_id: journal.id,
recipient_id: 1,
read_ian: false,
- sent_mail: false
+ mail_reminder_sent: false
})
end
end
diff --git a/spec/workers/mails/reminder_job_spec.rb b/spec/workers/mails/reminder_job_spec.rb
index 7d410e1c5d0..76419a76cbd 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(sent_mail: true, updated_at: Time.current)
+ .with(mail_reminder_sent: true, updated_at: Time.current)
end
it 'impersonates the recipient' do
diff --git a/spec/workers/notifications/workflow_job_spec.rb b/spec/workers/notifications/workflow_job_spec.rb
index cf919f03391..c10f630cc0c 100644
--- a/spec/workers/notifications/workflow_job_spec.rb
+++ b/spec/workers/notifications/workflow_job_spec.rb
@@ -109,7 +109,7 @@ describe Notifications::WorkflowJob, type: :model do
end
before do
- scope = class_double(Notification, unread_mail: [notifications.first])
+ scope = class_double(Notification, mail_alert_unsent: [notifications.first])
allow(Notification)
.to receive(:where)