Corrects error messages #265

Merged
osilkin98 merged 4 commits from fix-toasts into master 2020-01-29 20:08:33 +01:00
3 changed files with 66 additions and 44 deletions

61
dist/bundle.es.js vendored
View file

@ -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
});
@ -4269,7 +4257,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 +4282,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
}));
});
@ -4322,6 +4310,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({
@ -4329,7 +4321,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 +4341,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 +4896,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 +5916,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;

View file

@ -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,
})
);
@ -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 => {
@ -144,7 +150,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,
})
);
@ -166,18 +172,34 @@ 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: 'There was an error hiding this comment. Please try again later.',
message: 'Unable to edit this comment, please try again later.',
isError: true,
})
);

View file

@ -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,