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

[#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.rb
index 018d3b0b549..e572ed8caa3 100644
--- a/app/contracts/user_preferences/params_contract.rb
+++ b/app/contracts/user_preferences/params_contract.rb
@@ -28,8 +28,8 @@
module UserPreferences
class 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].freeze
validate :only_one_global_setting,
if: -> { notifications.present? }
@@ -69,8 +69,8 @@ module UserPreferences
def 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])
end
end
diff --git a/docs/api/apiv3/components/schemas/notification_settings_model.yml b/docs/api/apiv3/components/schemas/notification_settings_model.yml
index 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
- _links
properties:
- watched:
+ documentAdded:
+ type: boolean
+ forumMessages:
type: boolean
involved:
type: boolean
+ membershipAdded:
+ type: boolean
+ membershipUpdated:
+ type: boolean
mentioned:
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: boolean
workPackageCreated:
type: boolean
workPackageCommented:
@@ -39,22 +86,10 @@ items:
type: boolean
workPackageScheduled:
type: boolean
- newsAdded:
- type: boolean
- newsCommented:
- type: boolean
- documentAdded:
- type: boolean
- forumMessages:
- type: boolean
wikiPageAdded:
type: boolean
wikiPageUpdated:
type: boolean
- membershipAdded:
- type: boolean
- membershipUpdated:
- type: boolean
_links:
type: object
required:
@@ -68,4 +103,3 @@ items:
href:
type: string
format: uri
-
\ No newline at end of file