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

feat[Op#59434]: add notification reason `reminder`

Kabiru Mwenja6137d1b42724
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 65dff4c23ab..2b2fbc5c6e4 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -40,11 +40,11 @@ class Notification < ApplicationRecord
responsible: 9,
date_alert_start_date: 10,
date_alert_due_date: 11,
- shared: 12
+ shared: 12,
+ reminder: 13
}.freeze
- enum reason: REASONS,
- _prefix: true
+ enum :reason, REASONS, prefix: true
belongs_to :recipient, class_name: "User"
belongs_to :actor, class_name: "User"
diff --git a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb
index c0fb12c42cb..f146213883d 100644
--- a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb
+++ b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb
@@ -103,7 +103,7 @@ RSpec.describe API::V3::Notifications::NotificationRepresenter, "rendering" do
end
describe "reason" do
- (Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date]).each do |notification_reason|
+ (Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date reminder]).each do |notification_reason|
context "for a #{notification_reason} reason" do
let(:reason) { notification_reason }
diff --git a/spec/lib/api/v3/notifications/property_factory_spec.rb b/spec/lib/api/v3/notifications/property_factory_spec.rb
index 3ad53e613c5..653a567d106 100644
--- a/spec/lib/api/v3/notifications/property_factory_spec.rb
+++ b/spec/lib/api/v3/notifications/property_factory_spec.rb
@@ -106,7 +106,7 @@ RSpec.describe API::V3::Notifications::PropertyFactory do
end
end
- (Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date]).each do |possible_reason|
+ (Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date reminder]).each do |possible_reason|
context "for a #{possible_reason} notification" do
let(:reason) { possible_reason }
diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb
index 7e9c7304422..0007a19b60d 100644
--- a/spec/models/notification_spec.rb
+++ b/spec/models/notification_spec.rb
@@ -28,6 +28,30 @@
require "spec_helper"
RSpec.describe Notification do
+ describe "Enums" do
+ it do
+ expect(subject).to define_enum_for(:reason)
+ .with_values(
+ mentioned: 0,
+ assigned: 1,
+ watched: 2,
+ subscribed: 3,
+ commented: 4,
+ created: 5,
+ processed: 6,
+ prioritized: 7,
+ scheduled: 8,
+ responsible: 9,
+ date_alert_start_date: 10,
+ date_alert_due_date: 11,
+ shared: 12,
+ reminder: 13
+ )
+ .with_prefix
+ .backed_by_column_of_type(:integer)
+ end
+ end
+
describe ".save" do
context "for a non existing journal (e.g. because it has been deleted)" do
let(:notification) { build(:notification) }