Fix v1-publish items not removable (#1823)

## Issue
https://odysee-workspace.slack.com/archives/C02GSHBKYEM/p1657571082411839?thread_ts=1654909550.197639&cid=C02GSHBKYEM

If the user refreshed on a v1 upload, we can't do much but must at least provide a Cancel button for them to remove the entry.

## Change
- Restore the cancel button behavior for v1 like it was before.  The recent changes on the visibility of the Cancel button should only be applied to v2.
- Also fixed missing cancel button on v2 after refresh if the progress reached 100%.
This commit is contained in:
infinite-persistence 2022-07-12 13:13:58 +08:00 committed by GitHub
parent 62f90ae93e
commit 8aa6a60acf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -142,42 +142,44 @@ export default function WebUploadItem(props: Props) {
function getCancelButton() { function getCancelButton() {
if (!locked) { if (!locked) {
if (parseInt(progress) === 100) { if (resumable) {
return null; if (status === 'notify') {
} else if (status === 'notify') { return (
return ( <Button
<Button button="link"
button="link" label={__('Remove')}
label={__('Remove')} onClick={() => {
onClick={() => { doOpenModal(MODALS.CONFIRM, {
doOpenModal(MODALS.CONFIRM, { title: __('Remove entry?'),
title: __('Remove entry?'), body: (
body: ( <>
<> <p>
<p> {__('The file was successfully uploaded, but we could not retrieve the confirmation status.')}
{__('The file was successfully uploaded, but we could not retrieve the confirmation status.')} </p>
</p> <p>
<p> {__(
{__( 'Wait 5-10 minutes, then refresh and check the Uploads list and Wallet transactions before attempting to re-upload.'
'Wait 5-10 minutes, then refresh and check the Uploads list and Wallet transactions before attempting to re-upload.' )}
)} </p>
</p> <p className="section__subtitle">
<p className="section__subtitle"> {__('This entry can be safely removed if the transaction is visible in those pages.')}
{__('This entry can be safely removed if the transaction is visible in those pages.')} </p>
</p> <div className="help--warning">
<div className="help--warning"> <p>{__('Press OK to clear this entry from the "Currently Uploading" list.')}</p>
<p>{__('Press OK to clear this entry from the "Currently Uploading" list.')}</p> </div>
</div> </>
</> ),
), onConfirm: (closeModal) => {
onConfirm: (closeModal) => { doUpdateUploadRemove(params.guid);
doUpdateUploadRemove(params.guid); closeModal();
closeModal(); },
}, });
}); }}
}} />
/> );
); } else if (parseInt(progress) === 100) {
return null;
}
} }
return <Button label={__('Cancel')} button="link" onClick={handleCancel} />; return <Button label={__('Cancel')} button="link" onClick={handleCancel} />;