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 Representer & Database
Dmitriid386ad04105f
diff --git a/app/models/notification.rb b/app/models/notification.rbindex c228a953403..4feda5a0d3b 100644--- a/app/models/notification.rb+++ b/app/models/notification.rb@@ -9,7 +9,8 @@ class Notification < ApplicationRecordprocessed: 6,prioritized: 7,scheduled: 8,- responsible: 9+ responsible: 9,+ date_alert: 10}.freezeenum reason: REASONS,diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rbindex c22de824486..f2943cf7c62 100644--- a/app/models/notification_setting.rb+++ b/app/models/notification_setting.rb@@ -3,6 +3,9 @@ class NotificationSetting < ApplicationRecordASSIGNEE = :assigneeRESPONSIBLE = :responsibleMENTIONED = :mentioned+ START_DATE = :start_date+ DUE_DATE = :due_date+ OVERDUE = :overdueWORK_PACKAGE_CREATED = :work_package_createdWORK_PACKAGE_COMMENTED = :work_package_commentedWORK_PACKAGE_PROCESSED = :work_package_processed@@ -23,6 +26,9 @@ class NotificationSetting < ApplicationRecordASSIGNEE,RESPONSIBLE,MENTIONED,+ START_DATE,+ DUE_DATE,+ OVERDUE,WORK_PACKAGE_CREATED,WORK_PACKAGE_COMMENTED,WORK_PACKAGE_PROCESSED,@@ -50,4 +56,9 @@ class NotificationSetting < ApplicationRecordinclude Scopes::Scopedscopes :applicable++ validates :start_date, :due_date, :overdue, numericality: { only_integer: true,+ allow_nil: true,+ greater_than_or_equal_to: 0,+ less_than_or_equal_to: 168 }enddiff --git a/app/services/user_preferences/update_service.rb b/app/services/user_preferences/update_service.rbindex 65f4e3040c6..2402b263a0c 100644--- a/app/services/user_preferences/update_service.rb+++ b/app/services/user_preferences/update_service.rb@@ -50,7 +50,10 @@ module UserPreferencesreturn service_call if notifications.nil?inserted = persist_notifications- remove_other_notifications(inserted)++ if inserted.present?+ remove_other_notifications(inserted)+ endservice_callend@@ -93,6 +96,9 @@ module UserPreferencesassigneeresponsiblementioned+ start_date+ due_date+ overduework_package_commentedwork_package_createdwork_package_processed@@ -107,7 +113,7 @@ module UserPreferencesmembership_addedmembership_updated]},- validate: false+ validate: true).idsendenddiff --git a/db/migrate/20220918165443_add_start_date_due_date_and_overdue_to_notification_settings.rb b/db/migrate/20220918165443_add_start_date_due_date_and_overdue_to_notification_settings.rbnew file mode 100644index 00000000000..ddaa4cc94ca--- /dev/null+++ b/db/migrate/20220918165443_add_start_date_due_date_and_overdue_to_notification_settings.rb@@ -0,0 +1,9 @@+class AddStartDateDueDateAndOverdueToNotificationSettings < ActiveRecord::Migration[7.0]+ def change+ change_table :notification_settings, bulk: true do |t|+ t.column :start_date, :integer, default: 24+ t.column :due_date, :integer, default: 24+ t.column :overdue, :integer, default: nil+ end+ end+end