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
Update frontend/src/app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component.ts
Oliver Günther34c77bc5a2b9
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component.tsindex 3081e95cd74..3802b045cd9 100644--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component.ts@@ -32,9 +32,9 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';import { AuthorisationService } from 'core-app/core/model-auth/model-auth.service';import { Observable } from 'rxjs';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';-import { componentDestroyed } from '@w11k/ngx-componentdestroyed';import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';-import { filter, take } from 'rxjs/operators';+import { take } from 'rxjs/operators';+import { CurrentUserService } from 'core-app/core/current-user/current-user.service';@Component({selector: 'wp-create-button',@@ -63,12 +63,15 @@ export class WorkPackageCreateButtonComponent extends UntilDestroyedMixin implemexplanation: this.I18n.t('js.label_create_work_package'),};- constructor(readonly $state:StateService,+ constructor(+ readonly $state:StateService,+ readonly currentUser:CurrentUserService,readonly currentProject:CurrentProjectService,readonly authorisationService:AuthorisationService,readonly transition:TransitionService,readonly I18n:I18nService,- readonly cdRef:ChangeDetectorRef) {+ readonly cdRef:ChangeDetectorRef,+ ) {super();}@@ -76,20 +79,13 @@ export class WorkPackageCreateButtonComponent extends UntilDestroyedMixin implemthis.projectIdentifier = this.currentProject.identifier;// Find the first permission that is allowed- this.authorisationService- .observeUntil(componentDestroyed(this))+ this.currentUser+ .hasCapabilities$('work_packages/create', this.currentProject.id).pipe(- filter((links) => !!links.work_package),take(1),)- .subscribe(() => {- this.allowed = !!this- .allowedWhen- .find((combined) => {- const [module, permission] = combined.split('.');- return this.authorisationService.can(module, permission);- });-+ .subscribe((allowed) => {+ this.allowed = allowed;this.updateDisabledState();});