diff --git a/client/coral-admin/src/routes/Community/components/FlaggedUser.js b/client/coral-admin/src/routes/Community/components/FlaggedUser.js index 3526bcc37..f77b95b90 100644 --- a/client/coral-admin/src/routes/Community/components/FlaggedUser.js +++ b/client/coral-admin/src/routes/Community/components/FlaggedUser.js @@ -17,99 +17,115 @@ const shortReasons = { }; // Render a single user for the list -const User = (props) => { - const {user, modActionButtons} = props; +class User extends React.Component { - const showSuspenUserDialog = () => props.showSuspendUserDialog({ - userId: user.id, - username: user.username, + showSuspenUserDialog = () => this.props.showSuspendUserDialog({ + userId: this.props.user.id, + username: this.props.user.username, }); - const showBanUserDialog = () => props.showBanUserDialog({ - userId: user.id, - username: user.username, + showBanUserDialog = () => this.props.showBanUserDialog({ + userId: this.props.user.id, + username: this.props.user.username, }); - return ( -
  • -
    -
    -
    - - {props.me.id !== user.id && - - - Suspend User - - Ban User - - - } + viewAuthorDetail = () => this.props.viewUserDetail(this.props.user.id); + + render() { + const { + user, + modActionButtons, + viewUserDetail, + index, + selected, + isActive, + hideActive, + approveUser, + showRejectUsernameDialog, + me, + } = this.props; + + return ( +
  • +
    +
    +
    + + {me.id !== user.id && + + + Suspend User + + Ban User + + + } +
    -
    -
    -
    -
    - flag{t('community.flags')}({ user.actions.length }): +
    +
    +
    + flag{t('community.flags')}({ user.actions.length }): + { user.action_summaries.map( + (action, i) => { + return + {shortReasons[action.reason]} ({action.count}) + ; + } + )} +
    +
    { user.action_summaries.map( - (action, i) => { - return - {shortReasons[action.reason]} ({action.count}) - ; - } - )} -
    -
    - { user.action_summaries.map( - (action_sum, i) => { - return
    - - {shortReasons[action_sum.reason]} ({action_sum.count}) - - {user.actions.map( + (action_sum, i) => { + return
    + + {shortReasons[action_sum.reason]} ({action_sum.count}) + + {user.actions.map( - // find the action by action_sum.reason - (action, j) => { - if (action.reason === action_sum.reason) { - return

    - {action.user && - - } - : {action.message ? action.message : 'n/a'} -

    ; + // find the action by action_sum.reason + (action, j) => { + if (action.reason === action_sum.reason) { + return

    + {action.user && + + } + : {action.message ? action.message : 'n/a'} +

    ; + } + return null; } - return null; - } - )} -
    ; - } - )} + )} +
    ; + } + )} +
    -
    -
    -
    - {modActionButtons.map((action, i) => - - )} +
    +
    + {modActionButtons.map((action, i) => + + )} +
    -
    -
  • - ); -}; + + ); + } +} export default User;