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
Don't send reminder mails for read notification
Wieland Lindenthal984d82f29f05
diff --git a/app/models/notifications/scopes/unsent_reminders_before.rb b/app/models/notifications/scopes/unsent_reminders_before.rbindex e46f623164f..3456752ee70 100644--- a/app/models/notifications/scopes/unsent_reminders_before.rb+++ b/app/models/notifications/scopes/unsent_reminders_before.rb@@ -38,6 +38,7 @@ module Notifications::Scopesdef unsent_reminders_before(recipient:, time:)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)endenddiff --git a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb b/spec/models/notifications/scopes/unsent_reminders_before_spec.rbindex 9e0f0a63fdf..10ca824c94f 100644--- a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb+++ b/spec/models/notifications/scopes/unsent_reminders_before_spec.rb@@ -42,10 +42,12 @@ describe Notifications::Scopes::UnsentRemindersBefore, type: :model dolet(:notification) doFactoryBot.create(:notification,recipient: notification_recipient,+ read_ian: notification_read_ian,read_mail_digest: notification_read_mail_digest,created_at: notification_created_at)endlet(:notification_read_mail_digest) { false }+ let(:notification_read_ian) { false }let(:notification_created_at) { Time.current - 10.minutes }let(:notification_recipient) { recipient }@@ -58,35 +60,41 @@ describe Notifications::Scopes::UnsentRemindersBefore, type: :model doendend- context 'with a notification of the user for mail digests before the time' do+ context 'with a unread and not reminded notification that was created before the time and for the user' doit 'returns the notification' doexpect(scope).to match_array([notification])endend- context 'with a notification of the user for mail digests after the time' do+ context 'with a unread and not reminded notification that was created after the time and for the user' dolet(:notification_created_at) { Time.current + 10.minutes }it_behaves_like 'is empty'end- context 'with a notification of a different user for mail digests before the time' do+ context 'with a unread and not reminded notification that was created before the time and for different user' dolet(:notification_recipient) { FactoryBot.create(:user) }it_behaves_like 'is empty'end- context 'with a notification of a different user not for mail digests before the time' do+ context 'with a unread and not reminded notification created before the time and for the user' dolet(:notification_read_mail_digest) { nil }it_behaves_like 'is empty'end- context 'with a notification of a different user for already covered mail digests before the time' do+ context 'with a unread but reminded notification created before the time and for the user' dolet(:notification_read_mail_digest) { true }it_behaves_like 'is empty'end++ context 'with a read notification that was created before the time' do+ let(:notification_read_ian) { true }++ it_behaves_like 'is empty'+ endendend