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
[#43673] Include date alert into NotificationSetting api specs
Dombi Attilabbcfcf26be23
diff --git a/app/contracts/user_preferences/params_contract.rb b/app/contracts/user_preferences/params_contract.rbindex 018d3b0b549..e572ed8caa3 100644--- a/app/contracts/user_preferences/params_contract.rb+++ b/app/contracts/user_preferences/params_contract.rb@@ -28,8 +28,8 @@module UserPreferencesclass ParamsContract < ::ParamsContract- AVAILABLE_DATE = [nil, 0, 24, 72, 168].freeze- AVAILABLE_OVERDUE_DATE = [nil, 0, 72, 168].freeze+ DATE_ALERT_DURATIONS = [nil, 0, 24, 72, 168].freeze+ DATE_ALERT_OVERDUE_DURATIONS = [nil, 0, 72, 168].freezevalidate :only_one_global_setting,if: -> { notifications.present? }@@ -69,8 +69,8 @@ module UserPreferencesdef any_of_date_fields_fail_validation?(notifications_type)notifications_type.any? do |setting|setting.slice(:start_date, :due_date).detect do |_, date|- AVAILABLE_DATE.exclude?(date)- end || AVAILABLE_OVERDUE_DATE.exclude?(setting[:overdue])+ DATE_ALERT_DURATIONS.exclude?(date)+ end || DATE_ALERT_OVERDUE_DURATIONS.exclude?(setting[:overdue])endenddiff --git a/docs/api/apiv3/components/schemas/notification_settings_model.yml b/docs/api/apiv3/components/schemas/notification_settings_model.ymlindex 46882817af9..e3ea9c001dd 100644--- a/docs/api/apiv3/components/schemas/notification_settings_model.yml+++ b/docs/api/apiv3/components/schemas/notification_settings_model.yml@@ -23,12 +23,59 @@ items:- membershipUpdated- _linksproperties:- watched:+ documentAdded:+ type: boolean+ forumMessages:type: booleaninvolved:type: boolean+ membershipAdded:+ type: boolean+ membershipUpdated:+ type: booleanmentioned:type: boolean+ newsAdded:+ type: boolean+ newsCommented:+ type: boolean+ overdue:+ type: string+ description: |-+ Sets an overdue notification for work packages. It is null when no notification is set,+ otherwise it holds an ISO8601 formatted duration string with the possible values listed below.+ The possible values are: none, every day, every 3 days, every week.+ enum:+ - ""+ - PT0S+ - P3D+ - P1W+ startDate:+ type: string+ description: |-+ Sets a startDate notification for work packages. It is null when no notification is set,+ otherwise it holds an ISO8601 formatted duration string with the possible values listed below.+ The possible values are: same day, 1 day before, 3 days before, 1 week before.+ enum:+ - ""+ - PT0S+ - P1D+ - P3D+ - P1W+ dueDate:+ type: string+ description: |-+ Sets a startDate notification for work packages. It is null when no notification is set,+ otherwise it holds an ISO8601 formatted duration string with the possible values listed below.+ The possible values are: none, same day, 1 day before, 3 days before, 1 week before.+ enum:+ - ""+ - PT0S+ - P1D+ - P3D+ - P1W+ watched:+ type: booleanworkPackageCreated:type: booleanworkPackageCommented:@@ -39,22 +86,10 @@ items:type: booleanworkPackageScheduled:type: boolean- newsAdded:- type: boolean- newsCommented:- type: boolean- documentAdded:- type: boolean- forumMessages:- type: booleanwikiPageAdded:type: booleanwikiPageUpdated:type: boolean- membershipAdded:- type: boolean- membershipUpdated:- type: boolean_links:type: objectrequired:@@ -68,4 +103,3 @@ items:href:type: stringformat: uri-\ No newline at end of file