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
map date_alert reasons in API
ulfertsfbb58254b036
diff --git a/lib/api/v3/notifications/notification_representer.rb b/lib/api/v3/notifications/notification_representer.rbindex 9ab126fcf68..64e782320f9 100644--- a/lib/api/v3/notifications/notification_representer.rb+++ b/lib/api/v3/notifications/notification_representer.rb@@ -34,14 +34,22 @@ module APIinclude API::Decorators::LinkedResourceextend API::Decorators::PolymorphicResource- self_link title_getter: ->(*) {}+ self_link title: falseproperty :idproperty :read_ian,as: :readIAN- property :reason+ property :reason,+ getter: ->(*) do+ case reason+ when 'date_alert_start_date', 'date_alert_due_date'+ 'dateAlert'+ else+ reason+ end+ enddate_time_property :created_atdiff --git a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rbindex 45f0081b49b..dabe40359d9 100644--- a/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb+++ b/spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb@@ -103,8 +103,26 @@ describe ::API::V3::Notifications::NotificationRepresenter, 'rendering' dolet(:value) { notification.id }end- it_behaves_like 'property', :reason do- let(:value) { notification.reason }+ describe 'reason' do+ (Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date]).each do |notification_reason|+ context "for a #{notification_reason} reason" do+ let(:reason) { notification_reason }++ it_behaves_like 'property', :reason do+ let(:value) { notification_reason }+ end+ end+ end++ %i[date_alert_start_date date_alert_due_date].each do |notification_reason|+ context "for a #{notification_reason} reason" do+ let(:reason) { notification_reason }++ it_behaves_like 'property', :reason do+ let(:value) { 'dateAlert' }+ end+ end+ endendit_behaves_like 'datetime property', :createdAt do