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
add reminder settings to user administration
ulferts3dcf3610cab8
diff --git a/app/views/users/_reminders.html.erb b/app/views/users/_reminders.html.erbnew file mode 100644index 00000000000..dda35be8e84--- /dev/null+++ b/app/views/users/_reminders.html.erb@@ -0,0 +1,29 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) 2012-2021 the OpenProject GmbH++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License version 3.++OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+Copyright (C) 2006-2013 Jean-Philippe Lang+Copyright (C) 2010-2013 the ChiliProject Team++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License+as published by the Free Software Foundation; either version 2+of the License, or (at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.++See docs/COPYRIGHT.rdoc for more details.++++#%>+<openproject-base></openproject-base>diff --git a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.tsindex 717190a6ddf..cd5f2b6b2a9 100644--- a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts+++ b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts@@ -37,7 +37,7 @@ export class ReminderSettingsPageComponent implements OnInit {}ngOnInit():void {- this.userId = (this.userId || this.uiRouterGlobals.params.userId) as string;// || user.id!;+ this.userId = (this.userId || this.uiRouterGlobals.params.userId) as string;this.currentUserService.user$diff --git a/frontend/src/app/features/user-preferences/user-preferences.lazy-routes.ts b/frontend/src/app/features/user-preferences/user-preferences.lazy-routes.tsindex 51a75249c0f..32f48ceb820 100644--- a/frontend/src/app/features/user-preferences/user-preferences.lazy-routes.ts+++ b/frontend/src/app/features/user-preferences/user-preferences.lazy-routes.ts@@ -44,4 +44,9 @@ export const MY_ACCOUNT_LAZY_ROUTES:Ng2StateDeclaration[] = [url: '/my/reminders',loadChildren: () => import('./user-preferences.module').then((m) => m.OpenProjectMyAccountModule),},+ {+ name: 'user_reminders.**',+ url: '/users/:userId/edit/reminders',+ loadChildren: () => import('./user-preferences.module').then((m) => m.OpenProjectMyAccountModule),+ },];diff --git a/frontend/src/app/features/user-preferences/user-preferences.routes.ts b/frontend/src/app/features/user-preferences/user-preferences.routes.tsindex 9b6ec82df99..503bed756ab 100644--- a/frontend/src/app/features/user-preferences/user-preferences.routes.ts+++ b/frontend/src/app/features/user-preferences/user-preferences.routes.ts@@ -46,4 +46,9 @@ export const MY_ACCOUNT_ROUTES:Ng2StateDeclaration[] = [url: '/my/reminders',component: ReminderSettingsPageComponent,},+ {+ name: 'user_reminders',+ url: '/users/:userId/edit/reminders',+ component: ReminderSettingsPageComponent,+ },];diff --git a/lib/open_project/ui/extensible_tabs.rb b/lib/open_project/ui/extensible_tabs.rbindex ba91941b16b..7c5b7452334 100644--- a/lib/open_project/ui/extensible_tabs.rb+++ b/lib/open_project/ui/extensible_tabs.rb@@ -89,6 +89,12 @@ module OpenProjectpartial: 'users/notifications',path: ->(params) { edit_user_path(params[:user], tab: :notifications) },label: :'notifications.settings.title'+ },+ {+ name: 'reminders',+ partial: 'users/reminders',+ path: ->(params) { edit_user_path(params[:user], tab: :reminders) },+ label: :'reminders.settings.title'}]enddiff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rbindex 65581bfb608..9e653616969 100644--- a/spec/features/notifications/reminder_mail_spec.rb+++ b/spec/features/notifications/reminder_mail_spec.rb@@ -1,74 +1,65 @@require 'spec_helper'-require 'support/pages/my/notifications'+require_relative '../users/notifications/shared_examples'describe "Reminder email", type: :feature, js: true do- let!(:project) { FactoryBot.create :project, members: { current_user => role } }- let!(:mute_project) { FactoryBot.create :project, members: { current_user => role } }- let(:reminders_settings_page) { Pages::My::Reminders.new(current_user) }- let(:role) { FactoryBot.create(:role, permissions: %i[view_work_packages]) }- let(:other_user) { FactoryBot.create(:user) }- let(:work_package) { FactoryBot.create(:work_package, project: project) }- let(:watched_work_package) { FactoryBot.create(:work_package, project: project, watcher_users: [current_user]) }- let(:involved_work_package) { FactoryBot.create(:work_package, project: project, assigned_to: current_user) }-- current_user do- FactoryBot.create :user,- notification_settings: [- FactoryBot.build(:in_app_notification_setting,- involved: false,- watched: false,- mentioned: false,- work_package_commented: false,- work_package_created: false,- work_package_processed: false,- work_package_prioritized: false,- work_package_scheduled: false,- all: false)- ]- end+ shared_examples 'reminder settings' do+ it 'allows to configure the reminder settings' do+ # Configure the digest+ reminders_settings_page.visit!- before do- watched_work_package- work_package- involved_work_package+ # By default a reminder timed for 8:00 should be configured+ reminders_settings_page.expect_active_daily_times("08:00 am")- ActiveJob::Base.queue_adapter.enqueued_jobs.clear- end+ reminders_settings_page.add_time++ # The next suggested time is taken: 12:00+ reminders_settings_page.expect_active_daily_times("08:00 am", "12:00 pm")++ reminders_settings_page.set_time "Time 2", "03:00 pm"- it 'sends a reminder mail based on the configuration', with_settings: { journal_aggregation_time_minutes: 0 } do- # Configure the digest- reminders_settings_page.visit!+ reminders_settings_page.expect_active_daily_times("08:00 am", "03:00 pm")- # By default a reminder timed for 8:00 should be configured- reminders_settings_page.expect_active_daily_times("08:00 am")+ reminders_settings_page.save- reminders_settings_page.add_time+ reminders_settings_page.expect_and_dismiss_notification(message: I18n.t('js.notice_successful_update'))- # The next suggested time is taken: 12:00- reminders_settings_page.expect_active_daily_times("08:00 am", "12:00 pm")+ reminders_settings_page.reload!- reminders_settings_page.set_time "Time 2", "03:00 pm"+ # Deactivate the second time but then remove the first one will activate the second (then only) one+ # so that one time is always enabled.+ reminders_settings_page.expect_active_daily_times("08:00 am", "03:00 pm")+ reminders_settings_page.deactivate_time("Time 2")+ reminders_settings_page.remove_time("Time 1")- reminders_settings_page.expect_active_daily_times("08:00 am", "03:00 pm")+ reminders_settings_page.save- reminders_settings_page.save+ reminders_settings_page.expect_and_dismiss_notification(message: I18n.t('js.notice_successful_update'))- reminders_settings_page.expect_and_dismiss_notification(message: I18n.t('js.notice_successful_update'))+ reminders_settings_page.reload!- reminders_settings_page.reload!+ reminders_settings_page.expect_active_daily_times("03:00 pm")+ end+ end++ context 'with the my page' do+ let(:reminders_settings_page) { Pages::My::Reminders.new(current_user) }- # Deactivate the second time but then remove the first one will activate the second (then only) one- # so that one time is always enabled.- reminders_settings_page.expect_active_daily_times("08:00 am", "03:00 pm")- reminders_settings_page.deactivate_time("Time 2")- reminders_settings_page.remove_time("Time 1")+ current_user do+ FactoryBot.create :user+ end++ it_behaves_like 'reminder settings'+ end- reminders_settings_page.save+ context 'with the user administration page' do+ let(:reminders_settings_page) { Pages::Reminders::Settings.new(other_user) }- reminders_settings_page.expect_and_dismiss_notification(message: I18n.t('js.notice_successful_update'))+ let(:other_user) { FactoryBot.create :user }- reminders_settings_page.reload!+ current_user do+ FactoryBot.create :admin+ end- reminders_settings_page.expect_active_daily_times("03:00 pm")+ it_behaves_like 'reminder settings'endend