Upload: check if locked before confirming delete
## Reproduce Have 2 tabs + paused upload Open "cancel" dialog in one of the tabs. Continue upload in other tab Confirm cancellation in first tab Upload disappears from both tabs, but based on network traffic the upload keeps happening. (If upload finishes the claim seems to get created)
This commit is contained in:
parent
82bb785f9d
commit
b73edf2822
1 changed files with 16 additions and 9 deletions
|
@ -46,17 +46,24 @@ export default function WebUploadItem(props: Props) {
|
||||||
subtitle: __('Cancel and remove the selected upload?'),
|
subtitle: __('Cancel and remove the selected upload?'),
|
||||||
body: params.name ? <p className="empty">{`lbry://${params.name}`}</p> : undefined,
|
body: params.name ? <p className="empty">{`lbry://${params.name}`}</p> : undefined,
|
||||||
onConfirm: (closeModal) => {
|
onConfirm: (closeModal) => {
|
||||||
if (uploader) {
|
if (tusIsSessionLocked(params.guid)) {
|
||||||
if (resumable) {
|
// Corner-case: it's possible for the upload to resume in another tab
|
||||||
// $FlowFixMe - couldn't resolve to TusUploader manually.
|
// after the modal has appeared. Make a final lock-check here.
|
||||||
uploader.abort(true); // TUS
|
// We can invoke a toast here, but just do nothing for now.
|
||||||
} else {
|
// The upload status should make things obvious.
|
||||||
uploader.abort(); // XHR
|
} else {
|
||||||
|
if (uploader) {
|
||||||
|
if (resumable) {
|
||||||
|
// $FlowFixMe - couldn't resolve to TusUploader manually.
|
||||||
|
uploader.abort(true); // TUS
|
||||||
|
} else {
|
||||||
|
uploader.abort(); // XHR
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// The second parameter (params) can be removed after January 2022.
|
// The second parameter (params) can be removed after January 2022.
|
||||||
doUpdateUploadRemove(params.guid, params);
|
doUpdateUploadRemove(params.guid, params);
|
||||||
|
}
|
||||||
closeModal();
|
closeModal();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue