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
Must have enterprise token to create date alerts
Christophe Bliard4371b1c38744
diff --git a/app/services/authorization/enterprise_service.rb b/app/services/authorization/enterprise_service.rbindex 7a538aec1dc..5f50aa5f934 100644--- a/app/services/authorization/enterprise_service.rb+++ b/app/services/authorization/enterprise_service.rb@@ -30,23 +30,24 @@ class Authorization::EnterpriseServiceattr_accessor :tokenGUARDED_ACTIONS = %i(- define_custom_style- multiselect_custom_fields- edit_attribute_groups- work_package_query_relation_columns- attribute_help_texts- two_factor_authentication- ldap_groups- custom_fields_in_projects_list- custom_actions- conditional_highlighting- readonly_work_packagesattachment_filters+ attribute_help_textsboard_view+ conditional_highlighting+ custom_actions+ custom_fields_in_projects_list+ date_alerts+ define_custom_style+ edit_attribute_groupsgrid_widget_wp_graph+ ldap_groups+ multiselect_custom_fields+ openid_providersplaceholder_users+ readonly_work_packagesteam_planner_view- openid_providers+ two_factor_authentication+ work_package_query_relation_columns).freezedef initialize(token)diff --git a/app/workers/notifications/create_date_alerts_notifications_job.rb b/app/workers/notifications/create_date_alerts_notifications_job.rbindex f5d927a4480..188a06d24fa 100644--- a/app/workers/notifications/create_date_alerts_notifications_job.rb+++ b/app/workers/notifications/create_date_alerts_notifications_job.rb@@ -33,6 +33,8 @@ module Notificationsself.cron_expression = '*/15 * * * *'def perform+ return unless EnterpriseToken.allows_to?(:date_alerts)+time_zones = time_zones_covering_1am_local_timereturn if time_zones.empty?diff --git a/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb b/spec/workers/notifications/create_date_alerts_notifications_job_spec.rbindex 0cd79208c68..ccd9e32bc06 100644--- a/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb+++ b/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb@@ -28,7 +28,7 @@require 'spec_helper'-describe Notifications::CreateDateAlertsNotificationsJob, type: :job do+describe Notifications::CreateDateAlertsNotificationsJob, type: :job, with_ee: %i[date_alerts] doinclude ActiveSupport::Testing::TimeHelpersshared_let(:project) { create(:project, name: 'main') }@@ -240,6 +240,18 @@ describe Notifications::CreateDateAlertsNotificationsJob, type: :job doendend+ context 'without enterprise token', with_ee: false do+ it 'does not create any date alerts' do+ work_package = alertable_work_package+ set_scheduled_time(timezone_paris.now.change(hour: 1, min: 0))+ travel_to(timezone_paris.now.change(hour: 1, min: 4)) do+ scheduled_job.invoke_job++ expect(user_paris).not_to have_a_start_date_alert_notification_for(work_package)+ end+ end+ end+context 'when project notification settings are defined for a user' doit 'creates date alert notifications using these settings for work packages of the project' do# global notification settings