mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 01:35:11 +00:00
Enable 'slow mode' in comments
## Issue Sub item in <6119 Creator Settings: beyond "Muted Words"> ## Changes - Removed the existing 5s min gap on livestreams. - Enabled the 'slow mode min gap' in Creator Settings This change now affects both comments in claims and livestream comments.
This commit is contained in:
parent
6761cd2aa6
commit
26efe9fd45
5 changed files with 15 additions and 29 deletions
|
@ -1445,6 +1445,7 @@
|
||||||
"Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.",
|
"Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.",
|
||||||
"Unable to comment. Your channel has been blocked by an admin.": "Unable to comment. Your channel has been blocked by an admin.",
|
"Unable to comment. Your channel has been blocked by an admin.": "Unable to comment. Your channel has been blocked by an admin.",
|
||||||
"Unable to comment. The content owner has disabled comments.": "Unable to comment. The content owner has disabled comments.",
|
"Unable to comment. The content owner has disabled comments.": "Unable to comment. The content owner has disabled comments.",
|
||||||
|
"The creator has set a minimum time gap between comments. Try again later.": "The creator has set a minimum time gap between comments. Try again later.",
|
||||||
"The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%",
|
"The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%",
|
||||||
"Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.",
|
"Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.",
|
||||||
"Unable to delete this comment, please try again later.": "Unable to delete this comment, please try again later.",
|
"Unable to delete this comment, please try again later.": "Unable to delete this comment, please try again later.",
|
||||||
|
@ -1916,7 +1917,7 @@
|
||||||
"Suggestions": "Suggestions",
|
"Suggestions": "Suggestions",
|
||||||
"Add words to block": "Add words to block",
|
"Add words to block": "Add words to block",
|
||||||
"Enable comments for channel.": "Enable comments for channel.",
|
"Enable comments for channel.": "Enable comments for channel.",
|
||||||
"Minimum time gap in seconds for Slow Mode in livestream chat.": "Minimum time gap in seconds for Slow Mode in livestream chat.",
|
"Minimum time gap in seconds between comments (affects livestream chat as well).": "Minimum time gap in seconds between comments (affects livestream chat as well).",
|
||||||
"Minimum %lbc% tip amount for comments": "Minimum %lbc% tip amount for comments",
|
"Minimum %lbc% tip amount for comments": "Minimum %lbc% tip amount for comments",
|
||||||
"Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.",
|
"Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.",
|
||||||
"Minimum %lbc% tip amount for hyperchats": "Minimum %lbc% tip amount for hyperchats",
|
"Minimum %lbc% tip amount for hyperchats": "Minimum %lbc% tip amount for hyperchats",
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { doCommentCreate } from 'redux/actions/comments';
|
||||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||||
import { makeSelectCommentsDisabledForUri } from 'redux/selectors/comments';
|
import { makeSelectCommentsDisabledForUri } from 'redux/selectors/comments';
|
||||||
import { doToast } from 'redux/actions/notifications';
|
|
||||||
import { CommentCreate } from './view';
|
import { CommentCreate } from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -29,7 +28,6 @@ const perform = (dispatch, ownProps) => ({
|
||||||
dispatch(doCommentCreate(comment, claimId, parentId, ownProps.uri, ownProps.livestream, txid)),
|
dispatch(doCommentCreate(comment, claimId, parentId, ownProps.uri, ownProps.livestream, txid)),
|
||||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
||||||
toast: (message) => dispatch(doToast({ message, isError: true })),
|
|
||||||
sendTip: (params, callback, errorCallback) => dispatch(doSendTip(params, false, callback, errorCallback, false)),
|
sendTip: (params, callback, errorCallback) => dispatch(doSendTip(params, false, callback, errorCallback, false)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ import ChannelThumbnail from 'component/channelThumbnail';
|
||||||
import UriIndicator from 'component/uriIndicator';
|
import UriIndicator from 'component/uriIndicator';
|
||||||
import Empty from 'component/common/empty';
|
import Empty from 'component/common/empty';
|
||||||
|
|
||||||
const COMMENT_SLOW_MODE_SECONDS = 5;
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
claim: StreamClaim,
|
claim: StreamClaim,
|
||||||
|
@ -54,7 +52,6 @@ export function CommentCreate(props: Props) {
|
||||||
parentId,
|
parentId,
|
||||||
activeChannelClaim,
|
activeChannelClaim,
|
||||||
livestream,
|
livestream,
|
||||||
toast,
|
|
||||||
claimIsMine,
|
claimIsMine,
|
||||||
sendTip,
|
sendTip,
|
||||||
justCommented,
|
justCommented,
|
||||||
|
@ -72,7 +69,6 @@ export function CommentCreate(props: Props) {
|
||||||
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
|
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
|
||||||
const [tipAmount, setTipAmount] = React.useState(1);
|
const [tipAmount, setTipAmount] = React.useState(1);
|
||||||
const [commentValue, setCommentValue] = React.useState('');
|
const [commentValue, setCommentValue] = React.useState('');
|
||||||
const [lastCommentTime, setLastCommentTime] = React.useState();
|
|
||||||
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
|
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||||
const hasChannels = channels && channels.length;
|
const hasChannels = channels && channels.length;
|
||||||
const disabled = isSubmitting || !activeChannelClaim || !commentValue.length;
|
const disabled = isSubmitting || !activeChannelClaim || !commentValue.length;
|
||||||
|
@ -107,15 +103,6 @@ export function CommentCreate(props: Props) {
|
||||||
|
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
if (activeChannelClaim && commentValue.length) {
|
if (activeChannelClaim && commentValue.length) {
|
||||||
const timeUntilCanComment = !lastCommentTime
|
|
||||||
? 0
|
|
||||||
: (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.ceil(timeUntilCanComment) }));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleCreateComment();
|
handleCreateComment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +150,6 @@ export function CommentCreate(props: Props) {
|
||||||
|
|
||||||
if (res && res.signature) {
|
if (res && res.signature) {
|
||||||
setCommentValue('');
|
setCommentValue('');
|
||||||
setLastCommentTime(Date.now());
|
|
||||||
setIsReviewingSupportComment(false);
|
setIsReviewingSupportComment(false);
|
||||||
setIsSupportComment(false);
|
setIsSupportComment(false);
|
||||||
setCommentFailure(false);
|
setCommentFailure(false);
|
||||||
|
|
|
@ -265,18 +265,16 @@ export default function SettingsCreatorPage(props: Props) {
|
||||||
checked={commentsEnabled}
|
checked={commentsEnabled}
|
||||||
onChange={() => setSettings({ comments_enabled: !commentsEnabled })}
|
onChange={() => setSettings({ comments_enabled: !commentsEnabled })}
|
||||||
/>
|
/>
|
||||||
{FEATURE_IS_READY && (
|
<FormField
|
||||||
<FormField
|
name="slow_mode_min_gap"
|
||||||
name="slow_mode_min_gap"
|
label={__('Minimum time gap in seconds between comments (affects livestream chat as well).')}
|
||||||
label={__('Minimum time gap in seconds for Slow Mode in livestream chat.')}
|
min={0}
|
||||||
min={0}
|
step={1}
|
||||||
step={1}
|
type="number"
|
||||||
type="number"
|
placeholder="1"
|
||||||
placeholder="1"
|
value={slowModeMinGap}
|
||||||
value={slowModeMinGap}
|
onChange={(e) => setSettings({ slow_mode_min_gap: parseInt(e.target.value) })}
|
||||||
onChange={(e) => setSettings({ slow_mode_min_gap: e.target.value })}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -340,6 +340,9 @@ export function doCommentCreate(
|
||||||
case 'comments are disabled by the creator':
|
case 'comments are disabled by the creator':
|
||||||
toastMessage = __('Unable to comment. The content owner has disabled comments.');
|
toastMessage = __('Unable to comment. The content owner has disabled comments.');
|
||||||
break;
|
break;
|
||||||
|
case 'the creator has a min gap between comments set.':
|
||||||
|
toastMessage = __('The creator has set a minimum time gap between comments. Try again later.');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by';
|
const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by';
|
||||||
if (error.message.startsWith(BLOCKED_WORDS_ERR_MSG)) {
|
if (error.message.startsWith(BLOCKED_WORDS_ERR_MSG)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue