From 3262d136b730d7b046984396fbdbb4ea6c4ee51e Mon Sep 17 00:00:00 2001 From: David Jay Date: Wed, 8 Mar 2017 15:44:19 -0500 Subject: [PATCH 1/3] Resetting report menu on close. --- client/coral-plugin-flags/FlagButton.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/client/coral-plugin-flags/FlagButton.js b/client/coral-plugin-flags/FlagButton.js index 537d899cd..45110f407 100644 --- a/client/coral-plugin-flags/FlagButton.js +++ b/client/coral-plugin-flags/FlagButton.js @@ -32,18 +32,30 @@ class FlagButton extends Component { if (flagged) { this.setState((prev) => prev.localPost ? {...prev, localPost: null, step: 0} : {...prev, localDelete: true}); deleteAction(localPost || flag.current_user.id); + } else if (this.state.showMenu){ + this.closeMenu(); } else { - this.setState({showMenu: !this.state.showMenu}); + this.setState({showMenu: true}); } } + closeMenu = () => { + this.setState({ + showMenu: false, + itemType: '', + reason: '', + message: '', + step: 0 + }); + } + onPopupContinue = () => { const {postFlag, postDontAgree, id, author_id} = this.props; const {itemType, reason, step, posted, message} = this.state; // Proceed to the next step or close the menu if we've reached the end if (step + 1 >= this.props.getPopupMenu.length) { - this.setState({showMenu: false}); + this.closeMenu(); } else { this.setState({step: step + 1}); } @@ -114,7 +126,7 @@ class FlagButton extends Component { } handleClickOutside () { - this.setState({showMenu: false}); + this.closeMenu(); } render () { From d203a9afe0e7af60f47dd16e5e2c7123b489e30d Mon Sep 17 00:00:00 2001 From: David Jay Date: Wed, 8 Mar 2017 16:06:34 -0500 Subject: [PATCH 2/3] Auto-rejecting comments on ban. --- client/coral-admin/src/components/BanUserDialog.js | 10 ++++++++-- .../containers/ModerationQueue/ModerationContainer.js | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/client/coral-admin/src/components/BanUserDialog.js b/client/coral-admin/src/components/BanUserDialog.js index b23d8f9d1..f6a7227b8 100644 --- a/client/coral-admin/src/components/BanUserDialog.js +++ b/client/coral-admin/src/components/BanUserDialog.js @@ -8,7 +8,13 @@ import I18n from 'coral-framework/modules/i18n/i18n'; import translations from '../translations'; const lang = new I18n(translations); -const BanUserDialog = ({open, handleClose, handleBanUser, user}) => ( +const onBanClick = (userId, commentId, handleBanUser, rejectComment) => (e) => { + e.preventDefault(); + handleBanUser({userId}) + .then(() => rejectComment({commentId})); +}; + +const BanUserDialog = ({open, handleClose, handleBanUser, rejectComment, user, commentId}) => ( ( - diff --git a/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js b/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js index 2f43911b1..1d716ff41 100644 --- a/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js +++ b/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js @@ -26,7 +26,7 @@ class ModerationContainer extends Component { componentWillMount() { const {toggleModal, singleView} = this.props; - + this.props.fetchSettings(); key('s', () => singleView()); key('shift+/', () => toggleModal(true)); @@ -140,8 +140,10 @@ class ModerationContainer extends Component { Date: Wed, 8 Mar 2017 16:39:53 -0500 Subject: [PATCH 3/3] Closing ban dialog after ban is complete. --- client/coral-admin/src/components/BanUserDialog.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/coral-admin/src/components/BanUserDialog.js b/client/coral-admin/src/components/BanUserDialog.js index f6a7227b8..4f2296409 100644 --- a/client/coral-admin/src/components/BanUserDialog.js +++ b/client/coral-admin/src/components/BanUserDialog.js @@ -8,9 +8,10 @@ import I18n from 'coral-framework/modules/i18n/i18n'; import translations from '../translations'; const lang = new I18n(translations); -const onBanClick = (userId, commentId, handleBanUser, rejectComment) => (e) => { +const onBanClick = (userId, commentId, handleBanUser, rejectComment, handleClose) => (e) => { e.preventDefault(); handleBanUser({userId}) + .then(handleClose) .then(() => rejectComment({commentId})); }; @@ -35,7 +36,7 @@ const BanUserDialog = ({open, handleClose, handleBanUser, rejectComment, user, c -