mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
Port plugins
This commit is contained in:
@@ -1,23 +1,18 @@
|
||||
import React from 'react';
|
||||
import { compose } from 'react-apollo';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { getErrorMessages } from 'plugin-api/beta/client/utils';
|
||||
import { notify } from 'plugin-api/beta/client/actions/notification';
|
||||
import ApproveCommentAction from '../components/ApproveCommentAction';
|
||||
import { connect, withSetCommentStatus } from 'plugin-api/beta/client/hocs';
|
||||
|
||||
class ApproveCommentActionContainer extends React.Component {
|
||||
approveComment = async () => {
|
||||
const { setCommentStatus, comment, hideMenu, notify } = this.props;
|
||||
const { setCommentStatus, comment, hideMenu } = this.props;
|
||||
|
||||
try {
|
||||
await setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'ACCEPTED',
|
||||
});
|
||||
} catch (err) {
|
||||
notify('error', getErrorMessages(err));
|
||||
}
|
||||
await setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'ACCEPTED',
|
||||
});
|
||||
|
||||
hideMenu();
|
||||
};
|
||||
|
||||
@@ -9,13 +9,11 @@ import {
|
||||
withSetCommentStatus,
|
||||
withBanUser,
|
||||
} from 'plugin-api/beta/client/hocs';
|
||||
import { getErrorMessages } from 'plugin-api/beta/client/utils';
|
||||
import BanUserDialog from '../components/BanUserDialog';
|
||||
|
||||
class BanUserDialogContainer extends React.Component {
|
||||
banUser = async () => {
|
||||
const {
|
||||
notify,
|
||||
authorId,
|
||||
commentId,
|
||||
commentStatus,
|
||||
@@ -25,23 +23,19 @@ class BanUserDialogContainer extends React.Component {
|
||||
banUser,
|
||||
} = this.props;
|
||||
|
||||
try {
|
||||
await banUser({
|
||||
id: authorId,
|
||||
message: '',
|
||||
await banUser({
|
||||
id: authorId,
|
||||
message: '',
|
||||
});
|
||||
|
||||
closeMenu();
|
||||
closeBanDialog();
|
||||
|
||||
if (commentStatus !== 'REJECTED') {
|
||||
await setCommentStatus({
|
||||
commentId: commentId,
|
||||
status: 'REJECTED',
|
||||
});
|
||||
|
||||
closeMenu();
|
||||
closeBanDialog();
|
||||
|
||||
if (commentStatus !== 'REJECTED') {
|
||||
await setCommentStatus({
|
||||
commentId: commentId,
|
||||
status: 'REJECTED',
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
notify('error', getErrorMessages(err));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
import React from 'react';
|
||||
import { compose } from 'react-apollo';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { getErrorMessages } from 'plugin-api/beta/client/utils';
|
||||
import { notify } from 'plugin-api/beta/client/actions/notification';
|
||||
import RejectCommentAction from '../components/RejectCommentAction';
|
||||
import { connect, withSetCommentStatus } from 'plugin-api/beta/client/hocs';
|
||||
|
||||
class RejectCommentActionContainer extends React.Component {
|
||||
rejectComment = async () => {
|
||||
const { setCommentStatus, comment, hideMenu, notify } = this.props;
|
||||
const { setCommentStatus, comment, hideMenu } = this.props;
|
||||
|
||||
try {
|
||||
await setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'REJECTED',
|
||||
});
|
||||
} catch (err) {
|
||||
notify('error', getErrorMessages(err));
|
||||
}
|
||||
await setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'REJECTED',
|
||||
});
|
||||
|
||||
hideMenu();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user