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

Don't subscribe to subsequent updates of the work_package model auth

Oliver Günther4470076396f8
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.ts
index 27401a6854e..3081e95cd74 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
@@ -27,15 +27,14 @@
//++
import { StateService, TransitionService } from '@uirouter/core';
-import {
- ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit,
-} from '@angular/core';
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
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';
@Component({
selector: 'wp-create-button',
@@ -79,6 +78,10 @@ export class WorkPackageCreateButtonComponent extends UntilDestroyedMixin implem
// Find the first permission that is allowed
this.authorisationService
.observeUntil(componentDestroyed(this))
+ .pipe(
+ filter((links) => !!links.work_package),
+ take(1),
+ )
.subscribe(() => {
this.allowed = !!this
.allowedWhen