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

[#58271] Access token refresh results in error message in files tab

Dominic Bräunlein20bff0e23d80
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/work-package-single-view.base.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/work-package-single-view.base.ts
index a89498031d9..89851497d45 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/work-package-single-view.base.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/work-package-single-view.base.ts
@@ -188,16 +188,6 @@ export class WorkPackageSingleViewBase extends UntilDestroyedMixin {
this.attachmentsResourceService.fetchCollection(this.workPackage.$links.attachments.href as string).subscribe();
}
- if (this.workPackage.$links.fileLinks) {
- this.fileLinkResourceService
- .updateCollectionsForWorkPackage(this.workPackage.$links.fileLinks.href as string)
- .pipe(take(1))
- .subscribe(
- () => { /* Do nothing */ },
- (error:HttpErrorResponse) => { this.toastService.addError(error); },
- );
- }
-
// Listen to tab changes to update the tab label
this.keepTab.observable
.pipe(this.untilDestroyed())
diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.ts b/frontend/src/app/shared/components/storages/storage/storage.component.ts
index cc7ca74d77c..dd967426192 100644
--- a/frontend/src/app/shared/components/storages/storage/storage.component.ts
+++ b/frontend/src/app/shared/components/storages/storage/storage.component.ts
@@ -77,7 +77,7 @@ import { IHalResourceLink } from 'core-app/core/state/hal-resource';
import {
LocationPickerModalComponent,
} from 'core-app/shared/components/storages/location-picker-modal/location-picker-modal.component';
-import { ToastService } from 'core-app/shared/components/toaster/toast.service';
+import { IToast, ToastService } from 'core-app/shared/components/toaster/toast.service';
import { StorageFilesResourceService } from 'core-app/core/state/storage-files/storage-files.service';
import { IUploadFile, OpUploadService } from 'core-app/core/upload/upload.service';
import { IUploadLink } from 'core-app/core/state/storage-files/upload-link.model';
@@ -237,21 +237,27 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnD
ngOnInit():void {
this.storage = this.storagesResourceService.requireEntity(this.projectStorage._links.storage.href);
- this.fileLinks = this.collectionKey()
- .pipe(
- switchMap((key) => {
- if (isNewResource(this.resource)) {
- return this.fileLinkResourceService.collection(key);
- }
+ this.fileLinks = this.storage.pipe(
+ take(1),
+ switchMap(() =>
+ this.collectionKey().pipe(
+ switchMap((key) => {
+ if (isNewResource(this.resource)) {
+ return this.fileLinkResourceService.collection(key);
+ }
+ return this.fileLinkResourceService.requireCollection(key);
+ }),
+ tap((fileLinks) => {
+ if (isNewResource(this.resource)) {
+ this.resource.fileLinks = { elements: fileLinks.map((a) => a._links?.self) };
+ }
+ }),
+ )),
+ );
- return this.fileLinkResourceService.requireCollection(key);
- }),
- tap((fileLinks) => {
- if (isNewResource(this.resource)) {
- this.resource.fileLinks = { elements: fileLinks.map((a) => a._links?.self) };
- }
- }),
- );
+ this.fileLinks.subscribe({ error: (err:string | HttpErrorResponse | IToast) =>
+ this.toastService.addError(err),
+ });
this.disabled = combineLatest([
this.storage,