From 0a4e0ca33f2df3e51c570ba1c637d459a5bbe0a0 Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Tue, 28 Jan 2020 16:45:05 -0500 Subject: [PATCH 1/4] Corrects error messages --- src/redux/actions/comments.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/redux/actions/comments.js b/src/redux/actions/comments.js index 4441651..c31dfd3 100644 --- a/src/redux/actions/comments.js +++ b/src/redux/actions/comments.js @@ -76,7 +76,7 @@ export function doCommentCreate( }); dispatch( doToast({ - message: 'Oops, someone broke comments.', + message: 'Unable to create comment, please try again later.', isError: true, }) ); @@ -105,7 +105,7 @@ export function doCommentHide(comment_id: string) { }); dispatch( doToast({ - message: 'There was an error hiding this comment. Please try again later.', + message: 'Unable to hide this comment, please try again later.', isError: true, }) ); @@ -144,7 +144,7 @@ export function doCommentAbandon(comment_id: string) { }); dispatch( doToast({ - message: 'There was an error hiding this comment. Please try again later.', + message: 'Unable to delete this comment, please try again later.', isError: true, }) ); @@ -177,7 +177,7 @@ export function doCommentUpdate(comment_id: string, comment: string) { dispatch({ type: ACTIONS.COMMENT_UPDATE_FAILED, data: error }); dispatch( doToast({ - message: 'There was an error hiding this comment. Please try again later.', + message: 'Unable to edit this comment, please try again later.', isError: true, }) ); -- 2.45.3 From 50528607e79ce327db3a3868f347a366f27aaaaa Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Tue, 28 Jan 2020 17:20:23 -0500 Subject: [PATCH 2/4] Fixes bug where comments would be incorrectly marked as updated & adds user-friendly messages --- dist/bundle.es.js | 69 ++++++++++++++++++++-------------- src/redux/actions/comments.js | 30 +++++++++++---- src/redux/reducers/comments.js | 5 +-- 3 files changed, 64 insertions(+), 40 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 23581cf..5aeafb0 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -15,7 +15,6 @@ const CHANNEL_NEW = 'new'; const PAGE_SIZE = 20; var claim = /*#__PURE__*/Object.freeze({ - __proto__: null, MINIMUM_PUBLISH_BID: MINIMUM_PUBLISH_BID, CHANNEL_ANONYMOUS: CHANNEL_ANONYMOUS, CHANNEL_NEW: CHANNEL_NEW, @@ -286,8 +285,7 @@ const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL'; // Sync const USER_STATE_POPULATE = 'USER_STATE_POPULATE'; -var action_types = /*#__PURE__*/Object.freeze({ - __proto__: null, +var ACTIONS = /*#__PURE__*/Object.freeze({ WINDOW_FOCUSED: WINDOW_FOCUSED, DAEMON_READY: DAEMON_READY, DAEMON_VERSION_MATCH: DAEMON_VERSION_MATCH, @@ -542,7 +540,6 @@ const OTHER = 'other'; const COPYRIGHT = 'copyright'; var licenses = /*#__PURE__*/Object.freeze({ - __proto__: null, CC_LICENSES: CC_LICENSES, NONE: NONE, PUBLIC_DOMAIN: PUBLIC_DOMAIN, @@ -573,7 +570,6 @@ const HISTORY = 'user_history'; const WALLET = 'wallet'; var pages = /*#__PURE__*/Object.freeze({ - __proto__: null, AUTH: AUTH, BACKUP: BACKUP, CHANNEL: CHANNEL, @@ -623,7 +619,6 @@ const RECEIVE_INTERESTS_NOTIFICATIONS = 'receiveInterestsNotifications'; const RECEIVE_CREATOR_NOTIFICATIONS = 'receiveCreatorNotifications'; var settings = /*#__PURE__*/Object.freeze({ - __proto__: null, CREDIT_REQUIRED_ACKNOWLEDGED: CREDIT_REQUIRED_ACKNOWLEDGED, NEW_USER_ACKNOWLEDGED: NEW_USER_ACKNOWLEDGED, EMAIL_COLLECTION_ACKNOWLEDGED: EMAIL_COLLECTION_ACKNOWLEDGED, @@ -651,7 +646,6 @@ const TITLE = 'title'; const FILENAME = 'filename'; var sort_options = /*#__PURE__*/Object.freeze({ - __proto__: null, DATE_NEW: DATE_NEW, DATE_OLD: DATE_OLD, TITLE: TITLE, @@ -665,7 +659,6 @@ const COMPLETE = 'complete'; const MANUAL = 'manual'; var thumbnail_upload_statuses = /*#__PURE__*/Object.freeze({ - __proto__: null, API_DOWN: API_DOWN, READY: READY, IN_PROGRESS: IN_PROGRESS, @@ -685,7 +678,6 @@ const UPDATE = 'update'; const ABANDON = 'abandon'; var transaction_types = /*#__PURE__*/Object.freeze({ - __proto__: null, ALL: ALL, SPEND: SPEND, RECEIVE: RECEIVE, @@ -702,7 +694,6 @@ const PAGE_SIZE$1 = 50; const LATEST_PAGE_SIZE = 20; var transaction_list = /*#__PURE__*/Object.freeze({ - __proto__: null, PAGE_SIZE: PAGE_SIZE$1, LATEST_PAGE_SIZE: LATEST_PAGE_SIZE }); @@ -711,7 +702,6 @@ const SPEECH_STATUS = 'https://spee.ch/api/config/site/publishing'; const SPEECH_PUBLISH = 'https://spee.ch/api/claim/publish'; var speech_urls = /*#__PURE__*/Object.freeze({ - __proto__: null, SPEECH_STATUS: SPEECH_STATUS, SPEECH_PUBLISH: SPEECH_PUBLISH }); @@ -757,7 +747,6 @@ const WALLET_DIR = 'wallet_dir'; const WALLETS = 'wallets'; var daemon_settings = /*#__PURE__*/Object.freeze({ - __proto__: null, ANNOUNCE_HEAD_AND_SD_ONLY: ANNOUNCE_HEAD_AND_SD_ONLY, API: API, BLOB_DOWNLOAD_TIMEOUT: BLOB_DOWNLOAD_TIMEOUT, @@ -811,7 +800,6 @@ var daemon_settings = /*#__PURE__*/Object.freeze({ const WALLET_SERVERS = LBRYUM_SERVERS; var shared_preferences = /*#__PURE__*/Object.freeze({ - __proto__: null, WALLET_SERVERS: WALLET_SERVERS }); @@ -1264,6 +1252,18 @@ function buildURI(UrlObj, includeProto = true, protoDefault = 'lbry://') { deprecatedParts = _objectWithoutProperties(UrlObj, ['streamName', 'streamClaimId', 'channelName', 'channelClaimId', 'primaryClaimSequence', 'primaryBidPosition', 'secondaryClaimSequence', 'secondaryBidPosition']); const { claimId, claimName, contentName } = deprecatedParts; + { + if (claimId) { + console.error(__("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead")); + } + if (claimName) { + console.error(__("'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead")); + } + if (contentName) { + console.error(__("'contentName' should no longer be used. Use 'streamName' instead")); + } + } + if (!claimName && !channelName && !streamName) { console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")); } @@ -4269,7 +4269,7 @@ function doCommentCreate(comment = '', claim_id = '', channel, parent_id) { data: error }); dispatch(doToast({ - message: 'Oops, someone broke comments.', + message: 'Unable to create comment, please try again later.', isError: true })); }); @@ -4294,7 +4294,7 @@ function doCommentHide(comment_id) { data: error }); dispatch(doToast({ - message: 'There was an error hiding this comment. Please try again later.', + message: 'Unable to hide this comment, please try again later.', isError: true })); }); @@ -4329,7 +4329,7 @@ function doCommentAbandon(comment_id) { data: error }); dispatch(doToast({ - message: 'There was an error hiding this comment. Please try again later.', + message: 'Unable to delete this comment, please try again later.', isError: true })); }); @@ -4349,16 +4349,30 @@ function doCommentUpdate(comment_id, comment) { comment_id: comment_id, comment: comment }).then(result => { - dispatch({ - type: COMMENT_UPDATE_COMPLETED, - data: { - comment: result - } - }); + if (result != null) { + dispatch({ + type: COMMENT_UPDATE_COMPLETED, + data: { + comment: result + } + }); + } else { + // the result will return null + dispatch({ + type: undefined + }); + dispatch(doToast({ + message: 'Your channel is still being setup, try again in a few moments.', + isError: true + })); + } }).catch(error => { - dispatch({ type: COMMENT_UPDATE_FAILED, data: error }); + dispatch({ + type: COMMENT_UPDATE_FAILED, + data: error + }); dispatch(doToast({ - message: 'There was an error hiding this comment. Please try again later.', + message: 'Unable to edit this comment, please try again later.', isError: true })); }); @@ -4890,10 +4904,7 @@ const commentReducer = handleActions({ [COMMENT_UPDATE_COMPLETED]: (state, action) => { const { comment } = action.data; const commentById = Object.assign({}, state.commentById); - - if (comment) { - commentById[comment.comment_id] = comment; - } + commentById[comment.comment_id] = comment; return _extends$8({}, state, { commentById, @@ -5913,7 +5924,7 @@ const selectChannelIsBlocked = uri => reselect.createSelector(selectBlockedChann return state.includes(uri); }); -exports.ACTIONS = action_types; +exports.ACTIONS = ACTIONS; exports.CLAIM_VALUES = claim; exports.DAEMON_SETTINGS = daemon_settings; exports.DEFAULT_FOLLOWED_TAGS = DEFAULT_FOLLOWED_TAGS; diff --git a/src/redux/actions/comments.js b/src/redux/actions/comments.js index c31dfd3..4c6f876 100644 --- a/src/redux/actions/comments.js +++ b/src/redux/actions/comments.js @@ -166,15 +166,31 @@ export function doCommentUpdate(comment_id: string, comment: string) { comment: comment, }) .then((result: CommentUpdateResponse) => { - dispatch({ - type: ACTIONS.COMMENT_UPDATE_COMPLETED, - data: { - comment: result, - }, - }); + if (result != null) { + dispatch({ + type: ACTIONS.COMMENT_UPDATE_COMPLETED, + data: { + comment: result, + }, + }); + } else { + // the result will return null + dispatch({ + type: ACTIONS.COMENT_UPDATE_FAILED, + }); + dispatch( + doToast({ + message: 'Your channel is still being setup, try again in a few moments.', + isError: true, + }) + ); + } }) .catch(error => { - dispatch({ type: ACTIONS.COMMENT_UPDATE_FAILED, data: error }); + dispatch({ + type: ACTIONS.COMMENT_UPDATE_FAILED, + data: error, + }); dispatch( doToast({ message: 'Unable to edit this comment, please try again later.', diff --git a/src/redux/reducers/comments.js b/src/redux/reducers/comments.js index 493d225..46d08d8 100644 --- a/src/redux/reducers/comments.js +++ b/src/redux/reducers/comments.js @@ -121,10 +121,7 @@ export const commentReducer = handleActions( [ACTIONS.COMMENT_UPDATE_COMPLETED]: (state: CommentsState, action: any) => { const { comment } = action.data; const commentById = Object.assign({}, state.commentById); - - if (comment) { - commentById[comment.comment_id] = comment; - } + commentById[comment.comment_id] = comment; return { ...state, -- 2.45.3 From 4b4217879cc548bef0765e0ab205c19657f23322 Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Tue, 28 Jan 2020 17:34:28 -0500 Subject: [PATCH 3/4] Error for abandon operations as well --- dist/bundle.es.js | 4 ++++ src/redux/actions/comments.js | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 5aeafb0..af58953 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -4322,6 +4322,10 @@ function doCommentAbandon(comment_id) { dispatch({ type: COMMENT_ABANDON_FAILED }); + dispatch(doToast({ + message: 'Your channel is still being setup, try again in a few moments.', + isError: true + })); } }).catch(error => { dispatch({ diff --git a/src/redux/actions/comments.js b/src/redux/actions/comments.js index 4c6f876..5ddd34b 100644 --- a/src/redux/actions/comments.js +++ b/src/redux/actions/comments.js @@ -135,6 +135,12 @@ export function doCommentAbandon(comment_id: string) { dispatch({ type: ACTIONS.COMMENT_ABANDON_FAILED, }); + dispatch( + doToast({ + message: 'Your channel is still being setup, try again in a few moments.', + isError: true, + }) + ); } }) .catch(error => { -- 2.45.3 From e8602bdf5ef03ca909c11420bc8a10d8eaa4ee9f Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 29 Jan 2020 14:07:43 -0500 Subject: [PATCH 4/4] yarn build --- dist/bundle.es.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index af58953..116bb55 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1252,18 +1252,6 @@ function buildURI(UrlObj, includeProto = true, protoDefault = 'lbry://') { deprecatedParts = _objectWithoutProperties(UrlObj, ['streamName', 'streamClaimId', 'channelName', 'channelClaimId', 'primaryClaimSequence', 'primaryBidPosition', 'secondaryClaimSequence', 'secondaryBidPosition']); const { claimId, claimName, contentName } = deprecatedParts; - { - if (claimId) { - console.error(__("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead")); - } - if (claimName) { - console.error(__("'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead")); - } - if (contentName) { - console.error(__("'contentName' should no longer be used. Use 'streamName' instead")); - } - } - if (!claimName && !channelName && !streamName) { console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")); } -- 2.45.3