mirror of
https://github.com/wassname/talk.git
synced 2026-08-15 12:55:10 +08:00
Renaming
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {OPEN_MENU, CLOSE_MENU, OPEN_DIALOG, CLOSE_DIALOG} from './constants';
|
||||
import {OPEN_MENU, CLOSE_MENU, OPEN_BAN_DIALOG, CLOSE_BAN_DIALOG} from './constants';
|
||||
|
||||
export const openMenu = (id) => ({
|
||||
type: OPEN_MENU,
|
||||
@@ -9,11 +9,12 @@ export const closeMenu = () => ({
|
||||
type: CLOSE_MENU,
|
||||
});
|
||||
|
||||
export const openDialog = (comment) => ({
|
||||
type: OPEN_DIALOG,
|
||||
comment
|
||||
export const openBanDialog = ({commentId, authorId}) => ({
|
||||
type: OPEN_BAN_DIALOG,
|
||||
commentId,
|
||||
authorId
|
||||
});
|
||||
|
||||
export const closeDialog = () => ({
|
||||
type: CLOSE_DIALOG,
|
||||
export const closeBanDialog = () => ({
|
||||
type: CLOSE_BAN_DIALOG,
|
||||
});
|
||||
|
||||
@@ -2,5 +2,5 @@ const prefix = 'TALK_MODERATION_ACTIONS';
|
||||
|
||||
export const OPEN_MENU = `${prefix}_OPEN_MENU`;
|
||||
export const CLOSE_MENU = `${prefix}_CLOSE_MENU`;
|
||||
export const OPEN_DIALOG = `${prefix}_OPEN_DIALOG`;
|
||||
export const CLOSE_DIALOG = `${prefix}_CLOSE_DIALOG`;
|
||||
export const OPEN_BAN_DIALOG = `${prefix}_OPEN_BAN_DIALOG`;
|
||||
export const CLOSE_BAN_DIALOG = `${prefix}_CLOSE_BAN_DIALOG`;
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
import React from 'react';
|
||||
import {compose} from 'react-apollo';
|
||||
import {openDialog} from '../actions';
|
||||
import {openBanDialog} from '../actions';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import BanUserAction from '../components/BanUserAction';
|
||||
import {connect, excludeIf} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
class BanUserActionContainer extends React.Component {
|
||||
onBanUser = () => {
|
||||
this.props.openDialog(this.props.comment);
|
||||
this.props.openBanDialog({
|
||||
commentId: this.props.comment.id,
|
||||
authorId: this.props.comment.user.id
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return <BanUserAction
|
||||
onBanUser={this.onBanUser}
|
||||
comment={this.props.comment}
|
||||
openDialog={this.props.openDialog}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators({
|
||||
openDialog
|
||||
openBanDialog
|
||||
}, dispatch);
|
||||
|
||||
const enhance = compose(
|
||||
|
||||
@@ -13,7 +13,8 @@ class BanUserDialogContainer extends React.Component {
|
||||
banUser = async () => {
|
||||
const {
|
||||
notify,
|
||||
comment,
|
||||
authorId,
|
||||
commentId,
|
||||
closeMenu,
|
||||
closeDialog,
|
||||
setCommentStatus,
|
||||
@@ -22,7 +23,7 @@ class BanUserDialogContainer extends React.Component {
|
||||
|
||||
try {
|
||||
await setUserStatus({
|
||||
userId: comment.user.id,
|
||||
userId: authorId,
|
||||
status: 'BANNED'
|
||||
});
|
||||
|
||||
@@ -31,7 +32,7 @@ class BanUserDialogContainer extends React.Component {
|
||||
|
||||
if (comment.status !== 'REJECTED') {
|
||||
await setCommentStatus({
|
||||
commentId: comment.id,
|
||||
commentId: commentId,
|
||||
status: 'REJECTED'
|
||||
});
|
||||
}
|
||||
@@ -54,7 +55,8 @@ class BanUserDialogContainer extends React.Component {
|
||||
|
||||
const mapStateToProps = ({talkPluginModerationActions: state}) => ({
|
||||
showDialog: state.showDialog,
|
||||
comment: state.comment
|
||||
commentId: state.commentId,
|
||||
authorId: state.authorId
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
|
||||
@@ -22,7 +22,8 @@ export default function reducer(state = initialState, action) {
|
||||
return {
|
||||
...state,
|
||||
showDialog: true,
|
||||
comment: action.comment
|
||||
commentId: action.commentId,
|
||||
authorId: action.authorId
|
||||
};
|
||||
case CLOSE_DIALOG:
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user