This commit is contained in:
Raphael Wickihalder 2022-04-04 13:04:06 +02:00
commit 108b4a92a8
5 changed files with 20 additions and 2 deletions

View file

@ -1 +1,2 @@
**/plugins/inline-attachment/** **/plugins/inline-attachment/**
**/ui/constants/errors.js

View file

@ -2230,5 +2230,6 @@
"Active channel": "Active channel", "Active channel": "Active channel",
"This account has livestreaming disabled, please reach out to hello@odysee.com for assistance.": "This account has livestreaming disabled, please reach out to hello@odysee.com for assistance.", "This account has livestreaming disabled, please reach out to hello@odysee.com for assistance.": "This account has livestreaming disabled, please reach out to hello@odysee.com for assistance.",
"Attach images by pasting or drag-and-drop.": "Attach images by pasting or drag-and-drop.", "Attach images by pasting or drag-and-drop.": "Attach images by pasting or drag-and-drop.",
"There was a network error, but the publish may have been completed. Wait a few minutes, then check your Uploads or Wallet page to confirm.": "There was a network error, but the publish may have been completed. Wait a few minutes, then check your Uploads or Wallet page to confirm.",
"--end--": "--end--" "--end--": "--end--"
} }

View file

@ -1,2 +1,3 @@
export const ALREADY_CLAIMED = 'once the invite reward has been claimed the referrer cannot be changed'; export const ALREADY_CLAIMED = 'once the invite reward has been claimed the referrer cannot be changed';
export const REFERRER_NOT_FOUND = 'A odysee account could not be found for the referrer you provided.'; export const REFERRER_NOT_FOUND = 'A odysee account could not be found for the referrer you provided.';
export const PUBLISH_TIMEOUT_BUT_LIKELY_SUCCESSFUL = 'There was a network error, but the publish may have been completed. Wait a few minutes, then check your Uploads or Wallet page to confirm.';

View file

@ -1,4 +1,5 @@
// @flow // @flow
import { PUBLISH_TIMEOUT_BUT_LIKELY_SUCCESSFUL } from 'constants/errors';
import * as MODALS from 'constants/modal_types'; import * as MODALS from 'constants/modal_types';
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
@ -14,7 +15,7 @@ import {
selectReflectingById, selectReflectingById,
} from 'redux/selectors/claims'; } from 'redux/selectors/claims';
import { makeSelectPublishFormValue, selectPublishFormValues, selectMyClaimForUri } from 'redux/selectors/publish'; import { makeSelectPublishFormValue, selectPublishFormValues, selectMyClaimForUri } from 'redux/selectors/publish';
import { doError } from 'redux/actions/notifications'; import { doError, doToast } from 'redux/actions/notifications';
import { push } from 'connected-react-router'; import { push } from 'connected-react-router';
import analytics from 'analytics'; import analytics from 'analytics';
import { doOpenModal, doSetIncognito, doSetActiveChannel } from 'redux/actions/app'; import { doOpenModal, doSetIncognito, doSetActiveChannel } from 'redux/actions/app';
@ -282,7 +283,13 @@ export const doPublishDesktop = (filePath: string, preview?: boolean) => (dispat
actions.push({ actions.push({
type: ACTIONS.PUBLISH_FAIL, type: ACTIONS.PUBLISH_FAIL,
}); });
actions.push(doError({ message: error.message, cause: error.cause }));
if (error.message === PUBLISH_TIMEOUT_BUT_LIKELY_SUCCESSFUL) {
actions.push(doToast({ message: error.message, duration: 'long' }));
} else {
actions.push(doError({ message: error.message, cause: error.cause }));
}
dispatch(batchActions(...actions)); dispatch(batchActions(...actions));
}; };

View file

@ -3,6 +3,7 @@ import * as tus from 'tus-js-client';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { makeUploadRequest } from './publish-v1'; import { makeUploadRequest } from './publish-v1';
import { makeResumableUploadRequest } from './publish-v2'; import { makeResumableUploadRequest } from './publish-v2';
import { PUBLISH_TIMEOUT_BUT_LIKELY_SUCCESSFUL } from 'constants/errors';
// A modified version of Lbry.apiCall that allows // A modified version of Lbry.apiCall that allows
// to perform calling methods at arbitrary urls // to perform calling methods at arbitrary urls
@ -54,6 +55,13 @@ export default function apiPublishCallViaWeb(
if (xhr.status >= 200 && xhr.status < 300 && !xhr.response.error) { if (xhr.status >= 200 && xhr.status < 300 && !xhr.response.error) {
return resolve(xhr.response.result); return resolve(xhr.response.result);
} else if (xhr.response.error) { } else if (xhr.response.error) {
if (xhr.responseURL.endsWith('/notify')) {
// Temp handling until odysee-api/issues/401 is addressed.
const errMsg = xhr.response.error.message;
if (errMsg === 'file currently locked' || errMsg.endsWith('no such file or directory')) {
return Promise.reject(new Error(PUBLISH_TIMEOUT_BUT_LIKELY_SUCCESSFUL));
}
}
error = new Error(xhr.response.error.message); error = new Error(xhr.response.error.message);
} else { } else {
error = new Error(__('Upload likely timed out. Try a smaller file while we work on this.')); error = new Error(__('Upload likely timed out. Try a smaller file while we work on this.'));