mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 20:23:29 +08:00
Merge branch 'master' into add-missing-translation-keys
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import t from 'coral-framework/services/i18n';
|
||||
import t, { timeago } from 'coral-framework/services/i18n';
|
||||
import { can } from 'coral-framework/services/perms';
|
||||
import { isSuspended } from 'coral-framework/utils/user';
|
||||
|
||||
import Slot from 'coral-framework/components/Slot';
|
||||
import { connect } from 'react-redux';
|
||||
@@ -40,6 +41,17 @@ class CommentBox extends React.Component {
|
||||
currentUser,
|
||||
} = this.props;
|
||||
|
||||
if (isSuspended(currentUser)) {
|
||||
notify(
|
||||
'error',
|
||||
t(
|
||||
'error.temporarily_suspended',
|
||||
timeago(currentUser.status.suspension.until)
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!can(currentUser, 'INTERACT_WITH_COMMUNITY')) {
|
||||
notify('error', t('error.NOT_AUTHORIZED'));
|
||||
return;
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getReliability = reliabilityValue => {
|
||||
*/
|
||||
|
||||
export const isSuspended = user => {
|
||||
const suspensionUntil = get(user, 'state.status.suspension.until');
|
||||
const suspensionUntil = get(user, 'status.suspension.until');
|
||||
return user && suspensionUntil && new Date(suspensionUntil) > new Date();
|
||||
};
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ en:
|
||||
password: "Password must be at least 8 characters"
|
||||
username: "Usernames can contain letters numbers and _ only"
|
||||
unexpected: "Unexpected error occurred. Sorry!"
|
||||
temporarily_suspended: "Your account is currently suspended. It will be reactivated {0}. Please contact us if you have any questions."
|
||||
flag_comment: "Report comment"
|
||||
flag_reason: "Reason for reporting (Optional)"
|
||||
flag_username: "Report username"
|
||||
|
||||
Reference in New Issue
Block a user