mirror of
https://github.com/wassname/talk.git
synced 2026-08-02 13:10:23 +08:00
withQuery and withMutation support for notifyOnError (default: true)
This commit is contained in:
@@ -11,7 +11,6 @@ import {
|
||||
import { compose, gql } from 'react-apollo';
|
||||
import t, { timeago } from 'coral-framework/services/i18n';
|
||||
import withQuery from 'coral-framework/hocs/withQuery';
|
||||
import { getErrorMessages } from 'coral-framework/utils';
|
||||
import get from 'lodash/get';
|
||||
import { notify } from 'coral-framework/actions/notification';
|
||||
|
||||
@@ -28,17 +27,13 @@ class SuspendUserDialogContainer extends Component {
|
||||
notify,
|
||||
} = this.props;
|
||||
hideSuspendUserDialog();
|
||||
try {
|
||||
await suspendUser({ id: userId, message, until });
|
||||
notify(
|
||||
'success',
|
||||
t('suspenduser.notify_suspend_until', username, timeago(until))
|
||||
);
|
||||
if (commentId && commentStatus && commentStatus !== 'REJECTED') {
|
||||
await setCommentStatus({ commentId, status: 'REJECTED' });
|
||||
}
|
||||
} catch (err) {
|
||||
notify('error', getErrorMessages(err));
|
||||
await suspendUser({ id: userId, message, until });
|
||||
notify(
|
||||
'success',
|
||||
t('suspenduser.notify_suspend_until', username, timeago(until))
|
||||
);
|
||||
if (commentId && commentStatus && commentStatus !== 'REJECTED') {
|
||||
await setCommentStatus({ commentId, status: 'REJECTED' });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user