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
exclude notifications about which user was already alerted from unsent_reminders_before
Ivan Kuchinbd791ee44320
diff --git a/app/models/notifications/scopes/unsent_reminders_before.rb b/app/models/notifications/scopes/unsent_reminders_before.rbindex 75654bc6a45..4434f0b5032 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::Scopes.where(recipient:).where(read_ian: [false, nil]).where(mail_reminder_sent: false)+ .where(mail_alert_sent: [false, nil])endendenddiff --git a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb b/spec/models/notifications/scopes/unsent_reminders_before_spec.rbindex 6a9149cdb01..9d84b3ab017 100644--- a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb+++ b/spec/models/notifications/scopes/unsent_reminders_before_spec.rb@@ -44,14 +44,16 @@ RSpec.describe Notifications::Scopes::UnsentRemindersBefore dorecipient: notification_recipient,read_ian: notification_read_ian,mail_reminder_sent: notification_mail_reminder_sent,+ mail_alert_sent: notification_mail_alert_sent,created_at: notification_created_at)endlet(:notification_mail_reminder_sent) { false }+ let(:notification_mail_alert_sent) { false }let(:notification_read_ian) { false }let(:notification_created_at) { 10.minutes.ago }let(:notification_recipient) { recipient }- context "with an unread and not reminded notification that was created before the time and for the user" do+ context "with an unread, not alerted about and not reminded notification that was created before the time and for the user" doit "returns the notification" doexpect(scope).to contain_exactly(notification)end@@ -94,5 +96,19 @@ RSpec.describe Notifications::Scopes::UnsentRemindersBefore doit { is_expected.to be_empty }end++ context "with a notification alert mark set to nil" do+ let(:notification_mail_alert_sent) { nil }++ it "returns the notification" do+ expect(scope).to contain_exactly(notification)+ end+ end++ context "with a notification about which user was already alerted" do+ let(:notification_mail_alert_sent) { true }++ it { is_expected.to be_empty }+ endendend