Browse Source

Display an alert on locked posts as opposed to a disabled text field.

fix/custom_emoji_via_mardown-it-emoji
Eric 9 months ago
parent
commit
e67cd4e1cf
  1. 31
      src/components/comment-form.tsx
  2. 1
      translations/en.json

31
src/components/comment-form.tsx

@ -15,6 +15,7 @@ import {
toast,
isCommentChanged,
} from '../utils';
import { Icon } from './icon';
import { WebSocketService, UserService } from '../services';
import { i18n } from '../i18next';
import { Trans } from 'react-i18next';
@ -107,17 +108,27 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
return (
<div className="mb-3">
{UserService.Instance.user ? (
<MarkdownTextArea
initialContent={this.state.commentForm.content}
buttonTitle={this.state.buttonTitle}
finished={this.state.finished}
replyType={!!this.props.node}
focus={this.props.focus}
disabled={this.props.disabled}
onSubmit={this.handleCommentSubmit}
onReplyCancel={this.handleReplyCancel}
/>
this.props.disabled ? (
// Display a "locked" alert.
<div className="alert alert-light" role="alert">
<Icon name="lock" style={{ paddingBottom: 5 }} />
{i18n.t('post_locked')}
</div>
) : (
// Display a comment box.
<MarkdownTextArea
initialContent={this.state.commentForm.content}
buttonTitle={this.state.buttonTitle}
finished={this.state.finished}
replyType={!!this.props.node}
focus={this.props.focus}
disabled={this.props.disabled}
onSubmit={this.handleCommentSubmit}
onReplyCancel={this.handleReplyCancel}
/>
)
) : (
// Display a "login" alert.
<div className="alert alert-light" role="alert">
<svg className="icon icon-inline mr-2">
<use xlinkHref="#icon-alert-triangle" />

1
translations/en.json

@ -233,6 +233,7 @@
"not_logged_in": "Not logged in.",
"logged_in": "Logged in.",
"must_login": "You must <1>log in or register</1> to comment.",
"post_locked": "This post has been locked. You cannot comment on it.",
"site_saved": "Site Saved.",
"community_ban": "You have been banned from this community.",
"site_ban": "You have been banned from the site",

Loading…
Cancel
Save