Tell user when linked-comment is not available.
This commit is contained in:
parent
e77a986125
commit
4731588a3c
2 changed files with 12 additions and 2 deletions
|
@ -1445,6 +1445,7 @@
|
||||||
"You loved this": "You loved this",
|
"You loved this": "You loved this",
|
||||||
"Creator loved this": "Creator loved this",
|
"Creator loved this": "Creator loved this",
|
||||||
"A channel is required to throw fire and slime": "A channel is required to throw fire and slime",
|
"A channel is required to throw fire and slime": "A channel is required to throw fire and slime",
|
||||||
|
"The requested comment is no longer available.": "The requested comment is no longer available.",
|
||||||
"Best": "Best",
|
"Best": "Best",
|
||||||
"Controversial": "Controversial",
|
"Controversial": "Controversial",
|
||||||
"Show Replies": "Show Replies",
|
"Show Replies": "Show Replies",
|
||||||
|
|
|
@ -105,7 +105,7 @@ export function doCommentList(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doCommentById(commentId: string) {
|
export function doCommentById(commentId: string, toastIfNotFound: boolean = true) {
|
||||||
return (dispatch: Dispatch, getState: GetState) => {
|
return (dispatch: Dispatch, getState: GetState) => {
|
||||||
return Comments.comment_by_id({ comment_id: commentId, with_ancestors: true })
|
return Comments.comment_by_id({ comment_id: commentId, with_ancestors: true })
|
||||||
.then((result: CommentByIdResponse) => {
|
.then((result: CommentByIdResponse) => {
|
||||||
|
@ -122,7 +122,16 @@ export function doCommentById(commentId: string) {
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
devToast(dispatch, error.message);
|
if (error.message === 'sql: no rows in result set' && toastIfNotFound) {
|
||||||
|
dispatch(
|
||||||
|
doToast({
|
||||||
|
isError: true,
|
||||||
|
message: __('The requested comment is no longer available.'),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
devToast(dispatch, error.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue