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

Fire event for removed attachment only when after it is actually deleted

Henriette Dargee7a93751451e
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts
index d5dd582204f..f8cba9b772e 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts
@@ -31,7 +31,6 @@ import {
Component,
EventEmitter,
Input,
- OnInit,
Output,
} from '@angular/core';
import { IAttachment } from 'core-app/core/state/attachments/attachment.model';
@@ -43,7 +42,7 @@ import { AttachmentsResourceService } from 'core-app/core/state/attachments/atta
templateUrl: './attachment-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class OpAttachmentListComponent extends UntilDestroyedMixin implements OnInit {
+export class OpAttachmentListComponent extends UntilDestroyedMixin {
@Input() public attachments:IAttachment[] = [];
@Input() public collectionKey:string;
@@ -58,11 +57,9 @@ export class OpAttachmentListComponent extends UntilDestroyedMixin implements On
super();
}
- ngOnInit():void {
- }
-
public removeAttachment(attachment:IAttachment):void {
- this.attachmentsResourceService.removeAttachment(this.collectionKey, attachment).subscribe();
- this.attachmentRemoved.emit();
+ this.attachmentsResourceService.removeAttachment(this.collectionKey, attachment).subscribe(() => {
+ this.attachmentRemoved.emit();
+ });
}
}