diff --git a/client/coral-admin/src/actions/banUserDialog.js b/client/coral-admin/src/actions/banUserDialog.js index 8b068051c..8134318cb 100644 --- a/client/coral-admin/src/actions/banUserDialog.js +++ b/client/coral-admin/src/actions/banUserDialog.js @@ -4,4 +4,3 @@ export const showBanUserDialog = ({userId, username, commentId, commentStatus}) ({type: SHOW_BAN_USER_DIALOG, userId, username, commentId, commentStatus}); export const hideBanUserDialog = () => ({type: HIDE_BAN_USER_DIALOG}); - diff --git a/client/coral-admin/src/components/ActionsMenu.css b/client/coral-admin/src/components/ActionsMenu.css index 1d2f91f74..5d263ca21 100644 --- a/client/coral-admin/src/components/ActionsMenu.css +++ b/client/coral-admin/src/components/ActionsMenu.css @@ -8,9 +8,6 @@ color: black; > :global(.mdl-menu__container) { margin-left: 10px; - > :global(.mdl-menu__outline) { - box-shadow: none; - } } } @@ -18,12 +15,13 @@ box-shadow: none; color: white; background-color: #616161; + border-color: #616161; } .arrowIcon { margin-left: 6px; margin-right: 0; - vertical-align: middle; + vertical-align: middle; margin-right: 0; font-size: 14px; } @@ -33,8 +31,10 @@ } .menuItem { - background-color: #2a2a2a; - color: white; + color: #2a2a2a; + background-color: white; + font-size: 0.95em; + &:first-child { margin-bottom: 1px; border-radius: 2px 2px 0px 0px; @@ -43,7 +43,7 @@ border-radius: 0px 0px 2px 2px; } &:hover, &:active, &:focus { - background-color: #767676; + background-color: #e2e2e2; } &[disabled], &[disabled]:hover, &[disabled]:focus, &[disabled]:active { background-color: #262626; diff --git a/client/coral-admin/src/components/ActionsMenu.js b/client/coral-admin/src/components/ActionsMenu.js index 6351afda7..ef4e46573 100644 --- a/client/coral-admin/src/components/ActionsMenu.js +++ b/client/coral-admin/src/components/ActionsMenu.js @@ -32,18 +32,18 @@ class ActionsMenu extends React.Component { }; render() { - const {className = ''} = this.props; + const {className = '', buttonClassNames = '', label = ''} = this.props; return (
- {me.id !== user.id && - - - Suspend User - - - Ban User - - - }
@@ -137,8 +111,6 @@ class User extends React.Component { } User.propTypes = { - showSuspendUserDialog: PropTypes.func, - showBanUserDialog: PropTypes.func, viewUserDetail: PropTypes.func, showRejectUsernameDialog: PropTypes.func, approveUser: PropTypes.func, diff --git a/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js b/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js index 310e186e7..0313dd927 100644 --- a/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js +++ b/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js @@ -5,10 +5,7 @@ import {compose, gql} from 'react-apollo'; import {withFragments} from 'plugin-api/beta/client/hocs'; import {Spinner} from 'coral-ui'; import PropTypes from 'prop-types'; - import {withApproveUsername} from 'coral-framework/graphql/mutations'; -import {showBanUserDialog} from 'actions/banUserDialog'; -import {showSuspendUserDialog} from 'actions/suspendUserDialog'; import {showRejectUsernameDialog} from '../../../actions/community'; import {viewUserDetail} from '../../../actions/userDetail'; import {getDefinitionName} from 'coral-framework/utils'; @@ -60,8 +57,6 @@ class FlaggedAccountsContainer extends Component { } return ( bindActionCreators({ - showBanUserDialog, - showSuspendUserDialog, showRejectUsernameDialog, viewUserDetail, }, dispatch); diff --git a/client/coral-admin/src/routes/Moderation/components/Comment.js b/client/coral-admin/src/routes/Moderation/components/Comment.js index 441811e88..faeb694f6 100644 --- a/client/coral-admin/src/routes/Moderation/components/Comment.js +++ b/client/coral-admin/src/routes/Moderation/components/Comment.js @@ -8,8 +8,6 @@ import styles from './Comment.css'; import CommentLabels from 'coral-admin/src/components/CommentLabels'; import CommentAnimatedEdit from 'coral-admin/src/components/CommentAnimatedEdit'; import Slot from 'coral-framework/components/Slot'; -import ActionsMenu from 'coral-admin/src/components/ActionsMenu'; -import ActionsMenuItem from 'coral-admin/src/components/ActionsMenuItem'; import CommentBodyHighlighter from 'coral-admin/src/components/CommentBodyHighlighter'; import IfHasLink from 'coral-admin/src/components/IfHasLink'; import cn from 'classnames'; @@ -20,26 +18,6 @@ import t, {timeago} from 'coral-framework/services/i18n'; class Comment extends React.Component { - showSuspendUserDialog = () => { - const {comment, showSuspendUserDialog} = this.props; - return showSuspendUserDialog({ - userId: comment.user.id, - username: comment.user.username, - commentId: comment.id, - commentStatus: comment.status, - }); - }; - - showBanUserDialog = () => { - const {comment, showBanUserDialog} = this.props; - return showBanUserDialog({ - userId: comment.user.id, - username: comment.user.username, - commentId: comment.id, - commentStatus: comment.status, - }); - }; - viewUserDetail = () => { const {viewUserDetail, comment} = this.props; return viewUserDetail(comment.user.id); @@ -63,7 +41,6 @@ class Comment extends React.Component { data, root, root: {settings}, - currentUserId, currentAsset, } = this.props; @@ -79,13 +56,13 @@ class Comment extends React.Component {
- { - ( - - {comment.user.username} - - ) - } + + + {comment.user.username} + + {timeago(comment.created_at)} @@ -94,19 +71,6 @@ class Comment extends React.Component { ?  ({t('comment.edited')}) : null } - {currentUserId !== comment.user.id && - - - Suspend User - - Ban User - - - }
({ ...bindActionCreators({ toggleModal, singleView, - showBanUserDialog, hideShortcutsNote, toggleStorySearch, - showSuspendUserDialog, viewUserDetail, setSortOrder, storySearchChange, diff --git a/client/coral-ui/components/Drawer.js b/client/coral-ui/components/Drawer.js index d50237bfb..bada98a1f 100644 --- a/client/coral-ui/components/Drawer.js +++ b/client/coral-ui/components/Drawer.js @@ -1,10 +1,11 @@ import React from 'react'; +import cn from 'classnames'; import PropTypes from 'prop-types'; import styles from './Drawer.css'; -const Drawer = ({children, onClose}) => { +const Drawer = ({children, onClose, className = ''}) => { return ( -
+
×
{children} @@ -15,7 +16,9 @@ const Drawer = ({children, onClose}) => { Drawer.propTypes = { active: PropTypes.bool, - onClose: PropTypes.func.isRequired + onClose: PropTypes.func.isRequired, + children: PropTypes.node, + className: PropTypes.string, }; export default Drawer; diff --git a/package.json b/package.json index 3550be90a..95001d7da 100644 --- a/package.json +++ b/package.json @@ -149,7 +149,7 @@ "react-apollo": "^1.4.12", "react-dom": "^15.4.2", "react-input-autosize": "^1.1.4", - "react-mdl": "^1.7.2", + "react-mdl": "^1.11.0", "react-mdl-selectfield": "^0.2.0", "react-paginate": "^5.0.0", "react-recaptcha": "^2.2.6", diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index aa3b58ab5..173fff747 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -65,9 +65,7 @@ module.exports = { selector: '.talk-admin-moderation-container', elements: { comment: '.talk-admin-moderate-comment', - commentActionMenu: '.talk-admin-moderate-comment-actions-menu', - actionItemSuspendUser: '.action-menu-item#suspendUser', - actionMenuButton: '.talk-admin-moderate-comment-actions-menu #actions-dropdown-0' + commentUsername: '.talk-admin-moderate-comment-username', } }, stories: { @@ -116,6 +114,14 @@ module.exports = { } } }, + userDetailDrawer: { + selector: '.talk-admin-user-detail-drawer', + elements: { + 'actionsMenu': '.talk-admin-user-detail-actions-button', + 'actionItemSuspendUser': '.action-menu-item#suspendUser', + 'actionMenuButton': '.talk-admin-user-detail-actions-menu #actions-dropdown-0', + } + }, drawer: { selector: '.talk-admin-drawer-nav', commands: [{ diff --git a/test/e2e/specs/06_suspendUser.js b/test/e2e/specs/06_suspendUser.js index 20f38c2c2..a3da3c8ef 100644 --- a/test/e2e/specs/06_suspendUser.js +++ b/test/e2e/specs/06_suspendUser.js @@ -82,7 +82,7 @@ module.exports = { }, 'admin suspends user': (client) => { const adminPage = client.page.admin(); - const moderate = adminPage.section.moderate; + const {moderate, userDetailDrawer} = adminPage.section; adminPage .navigate() @@ -91,8 +91,11 @@ module.exports = { moderate .waitForElementVisible('@comment') - .waitForElementVisible('@commentActionMenu') - .waitForElementVisible('@actionMenuButton') + .waitForElementVisible('@commentUsername') + .click('@commentUsername'); + + userDetailDrawer + .waitForElementVisible('@actionsMenu') .click('@actionMenuButton') .waitForElementVisible('@actionItemSuspendUser') .click('@actionItemSuspendUser'); diff --git a/yarn.lock b/yarn.lock index 9f2d51b02..e94038032 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7524,16 +7524,7 @@ react-mdl-selectfield@^0.2.0: react-dom "^15.3.1" react-mdl "^1.7.1" -react-mdl@^1.7.1: - version "1.10.3" - resolved "https://registry.yarnpkg.com/react-mdl/-/react-mdl-1.10.3.tgz#f783e26a5eea4154a32129ab2562c09d5eeacf0d" - dependencies: - clamp "^1.0.1" - classnames "^2.2.3" - lodash.isequal "^4.4.0" - prop-types "^15.5.0" - -react-mdl@^1.7.2: +react-mdl@^1.11.0, react-mdl@^1.7.1: version "1.11.0" resolved "https://registry.yarnpkg.com/react-mdl/-/react-mdl-1.11.0.tgz#7e07ee1009dd9b358b616dc400ff2ae1845a2e67" dependencies: