Merge branch 'master' into add-missing-translation-keys

This commit is contained in:
Kim Gardner
2018-02-12 15:36:30 -05:00
committed by GitHub
3 changed files with 15 additions and 2 deletions
@@ -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;
+1 -1
View File
@@ -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();
};
+1
View File
@@ -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"