[ADF-4794] Not able to attach a second file to a form after one has already been attached (#5058)

This commit is contained in:
dhrn
2019-09-05 20:24:34 +05:30
committed by Eugenio Romano
parent 0d7795aa6d
commit d5e7c0066b
2 changed files with 50 additions and 8 deletions

View File

@@ -71,12 +71,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
}
ngOnInit() {
if (this.field &&
this.field.value &&
this.field.value.length > 0) {
this.hasFile = true;
}
this.getMultipleFileParam();
super.ngOnInit();
this.activitiContentService.getAlfrescoRepositories(null, true).subscribe((repoList) => {
this.repositoryList = repoList;
@@ -229,8 +224,9 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
this.logger.error(error);
},
() => {
this.field.value = filesSaved;
this.field.json.value = filesSaved;
const previousFiles = this.field.value;
this.field.value = [ ...previousFiles, ...filesSaved ];
this.field.json.value = [ ...previousFiles, ...filesSaved ];
this.hasFile = true;
});
}