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

[#53672] Extract some js statements into vars.

Pavel Balashou8169af552ac4
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
index 56becc03a35..9be6ba66135 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
@@ -40,13 +40,10 @@ export function workPackageFilesCount(
):Observable<number> {
const attachmentService = injector.get(AttachmentsResourceService);
const fileLinkService = injector.get(FileLinksResourceService);
+ const attachmentsCollection = workPackage.$links.attachments ? attachmentService.collection(workPackage.$links.attachments.href || '') : new BehaviorSubject([]);
+ const fileLinksCollection = fileLinkService.collection(workPackage.$links.fileLinks?.href || '');
return combineLatest(
- [
- workPackage.$links.attachments ? attachmentService.collection(workPackage.$links.attachments.href || '') : new BehaviorSubject([]),
- fileLinkService.collection(workPackage.$links.fileLinks?.href || ''),
- ],
- ).pipe(
- map(([a, f]) => a.length + f.length),
- );
+ [attachmentsCollection, fileLinksCollection],
+ ).pipe(map(([a, f]) => a.length + f.length));
}