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

[#41340] fixed attachments resource service

Eric Schubert19f3e846bf47
diff --git a/frontend/src/app/core/state/attachments/attachments.service.ts b/frontend/src/app/core/state/attachments/attachments.service.ts
index 2e058ea113e..4db449ecb6e 100644
--- a/frontend/src/app/core/state/attachments/attachments.service.ts
+++ b/frontend/src/app/core/state/attachments/attachments.service.ts
@@ -76,18 +76,16 @@ export class AttachmentsResourceService {
private readonly toastService:ToastService) { }
/**
- * Extension method that returns the same service instance after ensuring
- * that a specific collection is fetched, if not available.
+ * This method ensures that a specific collection is fetched, if not available.
*
* @param key The collection key, of the required collection.
*/
- requireCollection(key:string):AttachmentsResourceService {
+ requireCollection(key:string):void {
if (this.store.getValue().collections[key]) {
- return this;
+ return;
}
this.fetchAttachments(key).subscribe();
- return this;
}
/**
diff --git a/frontend/src/app/core/state/collection-store.ts b/frontend/src/app/core/state/collection-store.ts
index e609b2c0588..b686e40b50a 100644
--- a/frontend/src/app/core/state/collection-store.ts
+++ b/frontend/src/app/core/state/collection-store.ts
@@ -117,7 +117,7 @@ export function insertCollectionIntoState<T extends { id:ID }>(
const ids = collection._embedded.elements?.map((el) => el.id) || [];
applyTransaction(() => {
- store.add(collection._embedded.elements);
+ store.upsertMany(collection._embedded.elements);
store.update(({ collections }) => (
{
collections: {