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

Show details share button on the same capability

Oliver Günther1379e5833bd2
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 1e745cb0c3f..e5fd81f46ad 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
@@ -26,22 +26,26 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
+import {
+ HalResourceEditingService,
+} from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { Component, Input } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { ConfigurationService } from 'core-app/core/config/configuration.service';
+import { CurrentUserService } from 'core-app/core/current-user/current-user.service';
+import { Observable } from 'rxjs';
@Component({
selector: 'wp-details-toolbar',
templateUrl: './wp-details-toolbar.html',
})
-export class WorkPackageSplitViewToolbarComponent {
+export class WorkPackageSplitViewToolbarComponent implements OnInit {
@Input() workPackage:WorkPackageResource;
@Input() displayNotificationsButton:boolean;
- public displayShareButton = false;
+ public displayShareButton$:false|Observable<boolean> = false;
public text = {
button_more: this.I18n.t('js.button_more'),
@@ -51,7 +55,11 @@ export class WorkPackageSplitViewToolbarComponent {
readonly I18n:I18nService,
readonly halEditing:HalResourceEditingService,
readonly configurationService:ConfigurationService,
+ readonly currentUserService:CurrentUserService,
) {
- this.displayShareButton = true;
+ }
+
+ ngOnInit() {
+ this.displayShareButton$ = this.currentUserService.hasCapabilities$('work_package_shares/index', this.workPackage.project.id);
}
}
diff --git a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html
index ac8bd5f1958..320967c4ba4 100644
--- a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html
+++ b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html
@@ -11,7 +11,7 @@
></op-work-package-mark-notification-button>
<wp-share-button [workPackage]="workPackage"
- *ngIf="displayShareButton">
+ *ngIf="displayShareButton$ | async">
</wp-share-button>
<button class="button dropdown-relative"