mirror of
https://github.com/wassname/talk.git
synced 2026-08-14 12:50:17 +08:00
Merge branch 'master' into l10n-de
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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user