From 89a570f6bdfd41980ca79b5586e0cf7110376c4d Mon Sep 17 00:00:00 2001 From: Kabiru Mwenja Date: Mon, 20 Jan 2025 18:34:39 +0300 Subject: [PATCH] Just reuse `work_package/read` capability Managing reminders is based on the `view_work_packages` permission which is already indentified via `work_packages/read` capability. It would be redundant to introduce a new capability name --- config/initializers/permissions.rb | 3 +-- .../components/wp-details/wp-details-toolbar.component.ts | 2 +- .../routing/wp-full-view/wp-full-view.component.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rb index 68ae8d2026a2..9b6ce3a8e1ce 100644 --- a/config/initializers/permissions.rb +++ b/config/initializers/permissions.rb @@ -249,8 +249,7 @@ "work_packages/reminders": %i[modal_body create update destroy] }, permissible_on: %i[work_package project], - contract_actions: { work_packages: %i[read], - work_package_reminders: %i[manage] } + contract_actions: { work_packages: %i[read] } wpt.permission :add_work_packages, { diff --git a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts index eedef228d7aa..3017649a1cd3 100644 --- a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts +++ b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts @@ -66,7 +66,7 @@ export class WorkPackageSplitViewToolbarComponent implements OnInit { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access this.displayShareButton$ = this.currentUserService.hasCapabilities$('work_package_shares/index', this.workPackage.project.id); this.displayReminderButton$ = this.currentUserService.isLoggedInAndHasCapabalities$( - 'work_package_reminders/manage', + 'work_packages/read', (this.workPackage.project as ProjectResource).id, ); } diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts index af613927a117..f97c4bdc1646 100644 --- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts +++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts @@ -123,7 +123,7 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase imp this.displayTimerButton = Object.prototype.hasOwnProperty.call(wp, 'logTime'); this.displayShareButton$ = this.currentUserService.hasCapabilities$('work_package_shares/index', (wp.project as ProjectResource).id); this.displayReminderButton$ = this.currentUserService.isLoggedInAndHasCapabalities$( - 'work_package_reminders/manage', + 'work_packages/read', (this.workPackage.project as ProjectResource).id, );