mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added long comment check
This commit is contained in:
parent
7d09eb26f5
commit
58676ac1d5
2 changed files with 4 additions and 2 deletions
|
@ -41,6 +41,7 @@ export const ERRORS = {
|
|||
CANT_DELETE_COMMENT: 'CantDeleteComment',
|
||||
CANT_RESTORE_COMMENT: 'CantRestoreComment',
|
||||
MESSAGE_NOT_FOUND: 'MessageNotFound',
|
||||
COMMENT_TOO_LONG: 'CommentTooLong',
|
||||
};
|
||||
|
||||
export const ERROR_LITERAL = {
|
||||
|
@ -87,4 +88,5 @@ export const ERROR_LITERAL = {
|
|||
[ERRORS.CANT_DELETE_COMMENT]: 'Не удалось удалить комментарий',
|
||||
[ERRORS.CANT_RESTORE_COMMENT]: 'Не удалось восстановить комментарий',
|
||||
[ERRORS.MESSAGE_NOT_FOUND]: 'Сообщение не найдено',
|
||||
[ERRORS.COMMENT_TOO_LONG]: 'Комментарий слишком длинный',
|
||||
};
|
||||
|
|
|
@ -213,7 +213,7 @@ function* onPostComment({ id }: ReturnType<typeof nodePostComment>) {
|
|||
const { current: current_node } = yield select(selectNode);
|
||||
|
||||
if (current_node && current_node.id === current.id) {
|
||||
const { comments, comment_data } = yield select(selectNode);
|
||||
const { comments, comment_data: current_comment_data } = yield select(selectNode);
|
||||
|
||||
if (id === 0) {
|
||||
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
|
||||
|
@ -221,7 +221,7 @@ function* onPostComment({ id }: ReturnType<typeof nodePostComment>) {
|
|||
} else {
|
||||
yield put(
|
||||
nodeSet({
|
||||
comment_data: omit([id.toString()], comment_data),
|
||||
comment_data: omit([id.toString()], current_comment_data),
|
||||
comments: comments.map(item => (item.id === id ? comment : item)),
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue