mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-3447] Cancel upload of new version removes existing version (#5815)
* instead of deleting the whole node when we upload and then cancel a new version, we delete the version in case * reverting wrong auto indent * fix case name of the unit test * fix auto indent * fix auto indent
This commit is contained in:
@@ -275,7 +275,11 @@ export class UploadService {
|
||||
.on('success', (data) => {
|
||||
if (this.abortedFile === file.name) {
|
||||
this.onUploadAborted(file);
|
||||
this.deleteAbortedNode(data.entry.id);
|
||||
if (file.id === undefined) {
|
||||
this.deleteAbortedNode(data.entry.id);
|
||||
} else {
|
||||
this.deleteAbortedNodeVersion(data.entry.id, data.entry.properties['cm:versionLabel']);
|
||||
}
|
||||
if (emitter) {
|
||||
emitter.emit({ value: 'File deleted' });
|
||||
}
|
||||
@@ -405,6 +409,13 @@ export class UploadService {
|
||||
.then(() => (this.abortedFile = undefined));
|
||||
}
|
||||
|
||||
private deleteAbortedNodeVersion(nodeId: string, versionId: string) {
|
||||
this.apiService
|
||||
.getInstance()
|
||||
.core.versionsApi.deleteVersion(nodeId, versionId)
|
||||
.then(() => (this.abortedFile = undefined));
|
||||
}
|
||||
|
||||
private isSaveToAbortFile(file: FileModel): boolean {
|
||||
return (
|
||||
file.size > MIN_CANCELLABLE_FILE_SIZE &&
|
||||
|
Reference in New Issue
Block a user