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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[31504] Reload attachments again after coming from list
Oliver Günther2de62fef3610
diff --git a/frontend/src/app/modules/attachments/attachment-list/attachment-list.component.ts b/frontend/src/app/modules/attachments/attachment-list/attachment-list.component.tsindex 2781e4318a4..ef58ec98423 100644--- a/frontend/src/app/modules/attachments/attachment-list/attachment-list.component.ts+++ b/frontend/src/app/modules/attachments/attachment-list/attachment-list.component.ts@@ -40,7 +40,7 @@ import {AngularTrackingHelpers} from "core-components/angular/tracking-functionsselector: 'attachment-list',templateUrl: './attachment-list.html'})-export class AttachmentListComponent implements OnInit, OnChanges, OnDestroy {+export class AttachmentListComponent implements OnInit, OnDestroy {@Input() public resource:HalResource;@Input() public destroyImmediately:boolean = true;@@ -60,11 +60,7 @@ export class AttachmentListComponent implements OnInit, OnChanges, OnDestroy {ngOnInit() {this.$element = jQuery(this.elementRef.nativeElement);- if (this.attachmentsUpdatable) {- this.resource.updateAttachments();- }-- this.attachments = this.resource.attachments.elements;+ this.updateAttachments();this.setupResourceUpdateListener();if (!this.destroyImmediately) {@@ -81,7 +77,8 @@ export class AttachmentListComponent implements OnInit, OnChanges, OnDestroy {).subscribe((newResource:HalResource) => {this.resource = newResource || this.resource;- this.attachments = [...this.resource.attachments.elements];++ this.updateAttachments();this.cdRef.detectChanges();});}@@ -92,12 +89,6 @@ export class AttachmentListComponent implements OnInit, OnChanges, OnDestroy {}}- ngOnChanges() {- if (this.attachmentsUpdatable) {- this.resource.attachments.updateElements();- }- }-public removeAttachment(attachment:HalResource) {this.deletedAttachments.push(attachment);// Keep the same object as we would otherwise loose the connection to the@@ -128,6 +119,22 @@ export class AttachmentListComponent implements OnInit, OnChanges, OnDestroy {.removeAttachment(attachment);});}++ private updateAttachments() {+ if (!this.attachmentsUpdatable) {+ this.attachments = this.resource.attachments.elements;+ return;+ }++ this+ .resource+ .attachments+ .updateElements()+ .then(() => {+ this.attachments = this.resource.attachments.elements;+ this.cdRef.detectChanges();+ });+ }}DynamicBootstrapper.register({