Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flag users as "Always premoderate" (#2145)
* Flag users as "Always premoderate" Status can be set using the action dropdown in the People tab and in User Details. Users flagged as "Always premoderate" will have their comments sent to the premod queue. Users can be filtered with the Always Premoderate status. Include Always Premoderate status changes in User History. Add spanish translations. * Reorder CSS as per cvle's suggestion * Address second comment
- Loading branch information
1 parent
19b425d
commit 8163b52
Showing
38 changed files
with
714 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { | ||
SHOW_ALWAYS_PREMOD_USER_DIALOG, | ||
HIDE_ALWAYS_PREMOD_USER_DIALOG, | ||
} from '../constants/alwaysPremodUserDialog.js'; | ||
|
||
export const showAlwaysPremodUserDialog = ({ userId, username }) => ({ | ||
type: SHOW_ALWAYS_PREMOD_USER_DIALOG, | ||
userId, | ||
username, | ||
}); | ||
|
||
export const hideAlwaysPremodUserDialog = () => ({ | ||
type: HIDE_ALWAYS_PREMOD_USER_DIALOG, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
client/coral-admin/src/components/AlwaysPremodUserDialog.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.dialog { | ||
border: none; | ||
box-shadow: 0 9px 46px 8px rgba(0, 0, 0, 0.14), 0 11px 15px -7px rgba(0, 0, 0, 0.12), 0 24px 38px 3px rgba(0, 0, 0, 0.2); | ||
width: 400px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
padding: 20px; | ||
border-radius: 4px; | ||
} | ||
|
||
.header { | ||
color: black; | ||
font-size: 1.5em; | ||
font-weight: 500; | ||
margin: 0 0 8px 0; | ||
} | ||
|
||
.subheader { | ||
color: black; | ||
font-size: 1.3em; | ||
font-weight: 500; | ||
margin: 0 0 8px 0; | ||
} | ||
|
||
.buttons { | ||
margin-top: 8px; | ||
margin-bottom: 6px; | ||
text-align: right; | ||
} |
68 changes: 68 additions & 0 deletions
68
client/coral-admin/src/components/AlwaysPremodUserDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import cn from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import { Dialog } from 'coral-ui'; | ||
import styles from './AlwaysPremodUserDialog.css'; | ||
|
||
import Button from 'coral-ui/components/Button'; | ||
import t from 'coral-framework/services/i18n'; | ||
|
||
class AlwaysPremodUserDialog extends React.Component { | ||
handlePerform = () => { | ||
this.props.onPerform(); | ||
}; | ||
|
||
render() { | ||
const { open, onCancel, username, info } = this.props; | ||
return ( | ||
<Dialog | ||
className={cn(styles.dialog, 'talk-always-premod-user-dialog')} | ||
id="alwaysPremodUserDialog" | ||
open={open} | ||
onCancel={onCancel} | ||
title={t('alwayspremoddialog.always_premod_user')} | ||
> | ||
<span className={styles.close} onClick={onCancel}> | ||
× | ||
</span> | ||
<section> | ||
<h2 className={styles.header}> | ||
{t('alwayspremoddialog.always_premod_user')} | ||
</h2> | ||
<h3 className={styles.subheader}> | ||
{t('alwayspremoddialog.are_you_sure', username)} | ||
</h3> | ||
<p className={styles.description}>{info}</p> | ||
<div className={styles.buttons}> | ||
<Button | ||
className={cn('talk-always-premod-user-dialog-button-cancel')} | ||
cStyle="white" | ||
onClick={onCancel} | ||
raised | ||
> | ||
{t('alwayspremoddialog.cancel')} | ||
</Button> | ||
<Button | ||
className={cn('talk-always-premod-user-dialog-button-confirm')} | ||
cStyle="black" | ||
onClick={this.handlePerform} | ||
raised | ||
> | ||
{t('alwayspremoddialog.yes_always_premod_user')} | ||
</Button> | ||
</div> | ||
</section> | ||
</Dialog> | ||
); | ||
} | ||
} | ||
|
||
AlwaysPremodUserDialog.propTypes = { | ||
open: PropTypes.bool, | ||
onPerform: PropTypes.func.isRequired, | ||
onCancel: PropTypes.func.isRequired, | ||
username: PropTypes.string, | ||
info: PropTypes.string, | ||
}; | ||
|
||
export default AlwaysPremodUserDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const SHOW_ALWAYS_PREMOD_USER_DIALOG = 'SHOW_ALWAYS_PREMOD_USER_DIALOG'; | ||
export const HIDE_ALWAYS_PREMOD_USER_DIALOG = 'HIDE_ALWAYS_PREMOD_USER_DIALOG'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
client/coral-admin/src/containers/AlwaysPremodUserDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { bindActionCreators } from 'redux'; | ||
import AlwaysPremodUserDialog from '../components/AlwaysPremodUserDialog'; | ||
import { hideAlwaysPremodUserDialog } from '../actions/alwaysPremodUserDialog'; | ||
import { withAlwaysPremodUser } from 'coral-framework/graphql/mutations'; | ||
import { compose } from 'react-apollo'; | ||
import t from 'coral-framework/services/i18n'; | ||
|
||
class AlwaysPremodUserDialogContainer extends Component { | ||
alwaysPremodUser = async () => { | ||
const { userId, alwaysPremodUser, hideAlwaysPremodUserDialog } = this.props; | ||
await alwaysPremodUser({ id: userId }); | ||
hideAlwaysPremodUserDialog(); | ||
}; | ||
|
||
getInfo() { | ||
let note = t('alwayspremoddialog.note_always_premod_user'); | ||
return t('alwayspremoddialog.note', note); | ||
} | ||
|
||
render() { | ||
return ( | ||
<AlwaysPremodUserDialog | ||
open={this.props.open} | ||
onPerform={this.alwaysPremodUser} | ||
onCancel={this.props.hideAlwaysPremodUserDialog} | ||
username={this.props.username} | ||
info={this.getInfo()} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
AlwaysPremodUserDialogContainer.propTypes = { | ||
alwaysPremodUser: PropTypes.func.isRequired, | ||
hideAlwaysPremodUserDialog: PropTypes.func, | ||
open: PropTypes.bool, | ||
username: PropTypes.string, | ||
}; | ||
|
||
const mapStateToProps = ({ | ||
alwaysPremodUserDialog: { open, userId, username }, | ||
}) => ({ | ||
open, | ||
userId, | ||
username, | ||
}); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
...bindActionCreators( | ||
{ | ||
hideAlwaysPremodUserDialog, | ||
}, | ||
dispatch | ||
), | ||
}); | ||
|
||
export default compose( | ||
connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
), | ||
withAlwaysPremodUser | ||
)(AlwaysPremodUserDialogContainer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.