From 0ec31d3c299c7adcb2161b0c717146ccd68c97ac Mon Sep 17 00:00:00 2001 From: DispatchCommit Date: Mon, 22 Mar 2021 14:13:15 -0700 Subject: [PATCH] fix slow mode chat set last comment time when comment is submitted --- ui/component/commentCreate/view.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/component/commentCreate/view.jsx b/ui/component/commentCreate/view.jsx index 814b7f71e..53f20d0d8 100644 --- a/ui/component/commentCreate/view.jsx +++ b/ui/component/commentCreate/view.jsx @@ -98,11 +98,11 @@ export function CommentCreate(props: Props) { if (activeChannelClaim && commentValue.length) { const timeUntilCanComment = !lastCommentTime ? 0 - : lastCommentTime / 1000 - Date.now() / 1000 + COMMENT_SLOW_MODE_SECONDS; + : (lastCommentTime - Date.now()) / 1000 + COMMENT_SLOW_MODE_SECONDS; if (livestream && !claimIsMine && timeUntilCanComment > 0) { toast( - __('Slowmode is on. You can comment again in %time% seconds.', { time: Math.floor(timeUntilCanComment) }) + __('Slowmode is on. You can comment again in %time% seconds.', { time: Math.ceil(timeUntilCanComment) }) ); return; } @@ -110,6 +110,7 @@ export function CommentCreate(props: Props) { createComment(commentValue, claimId, parentId).then((res) => { if (res && res.signature) { setCommentValue(''); + setLastCommentTime(Date.now()); if (onDoneReplying) { onDoneReplying();