Comments Pagination #6390

Merged
infinite-persistence merged 8 commits from ip/comment.pagination into master 2021-07-14 16:42:11 +02:00
2 changed files with 12 additions and 2 deletions
Showing only changes of commit 4731588a3c - Show all commits

View file

@ -1445,6 +1445,7 @@
"You loved this": "You 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",
"The requested comment is no longer available.": "The requested comment is no longer available.",
"Best": "Best",
"Controversial": "Controversial",
"Show Replies": "Show Replies",

View file

@ -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 Comments.comment_by_id({ comment_id: commentId, with_ancestors: true })
.then((result: CommentByIdResponse) => {
@ -122,7 +122,16 @@ export function doCommentById(commentId: string) {
return result;
})
.catch((error) => {
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);
}
});
};
}