-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into translations
- Loading branch information
Showing
64 changed files
with
495 additions
and
1,743 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,6 @@ dump.rdb | |
*.cfg | ||
.idea/ | ||
coverage/ | ||
.tags | ||
.tags1 | ||
translations.txt | ||
|
||
# remove plugin folders | ||
plugins | ||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
import React from 'react'; | ||
import {Button, Icon} from 'react-mdl'; | ||
import styles from './Modal.css'; | ||
|
File renamed without changes.
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,106 @@ | ||
import I18n from 'coral-framework/modules/i18n/i18n'; | ||
import translations from '../translations.json'; | ||
import React, {Component, PropTypes} from 'react'; | ||
import Modal from 'components/Modal'; | ||
import styles from './SuspendUserModal.css'; | ||
import {Button} from 'coral-ui'; | ||
|
||
const stages = [ | ||
{ | ||
title: 'suspenduser.title_0', | ||
description: 'suspenduser.description_0', | ||
options: { | ||
'j': 'suspenduser.no_cancel', | ||
'k': 'suspenduser.yes_suspend' | ||
} | ||
}, | ||
{ | ||
title: 'suspenduser.title_1', | ||
description: 'suspenduser.description_1', | ||
options: { | ||
'j': 'bandialog.cancel', | ||
'k': 'suspenduser.send' | ||
} | ||
} | ||
]; | ||
|
||
class SuspendUserModal extends Component { | ||
|
||
state = {email: '', stage: 0} | ||
|
||
static propTypes = { | ||
stage: PropTypes.number, | ||
actionType: PropTypes.string, | ||
onClose: PropTypes.func.isRequired, | ||
suspendUser: PropTypes.func.isRequired | ||
} | ||
|
||
componentDidMount() { | ||
const about = lang.t('suspenduser.username'); | ||
this.setState({email: lang.t('suspenduser.email', about)}); | ||
} | ||
|
||
/* | ||
* When an admin clicks to suspend a user a dialog is shown, this function | ||
* handles the possible actions for that dialog. | ||
*/ | ||
onActionClick = (stage, menuOption) => () => { | ||
const {suspendUser, action} = this.props; | ||
const {stage, email} = this.state; | ||
const cancel = this.props.onClose; | ||
const next = () => this.setState({stage: stage + 1}); | ||
const suspend = () => suspendUser(action.item_id, lang.t('suspenduser.email_subject'), email) | ||
.then(this.props.onClose); | ||
const suspendModalActions = [ | ||
[ cancel, next ], | ||
[ cancel, suspend ] | ||
]; | ||
return suspendModalActions[stage][menuOption](); | ||
} | ||
|
||
onEmailChange = (e) => this.setState({email: e.target.value}) | ||
|
||
render () { | ||
const {action, onClose} = this.props; | ||
|
||
if (!action) { | ||
return null; | ||
} | ||
|
||
const {stage} = this.state; | ||
const actionType = action.actionType; | ||
const about = actionType === 'flag_bio' ? lang.t('suspenduser.bio') : lang.t('suspenduser.username'); | ||
return <Modal open={true} onClose={onClose}> | ||
<div className={styles.title}>{lang.t(stages[stage].title, about)}</div> | ||
<div className={styles.container}> | ||
<div className={styles.description}> | ||
{lang.t(stages[stage].description, about)} | ||
</div> | ||
{ | ||
stage === 1 && | ||
<div className={styles.writeContainer}> | ||
<div className={styles.emailMessage}>{lang.t('suspenduser.write_message')}</div> | ||
<div className={styles.emailContainer}> | ||
<textarea | ||
rows={5} | ||
className={styles.emailInput} | ||
value={this.state.email} | ||
onChange={this.onEmailChange}/> | ||
</div> | ||
</div> | ||
} | ||
<div className={styles.modalButtons}> | ||
{Object.keys(stages[stage].options).map((key, i) => ( | ||
<Button key={i} onClick={this.onActionClick(stage, i)}> | ||
{lang.t(stages[stage].options[key], about)} | ||
</Button> | ||
))} | ||
</div> | ||
</div> | ||
</Modal>; | ||
} | ||
} | ||
|
||
export default SuspendUserModal; | ||
|
||
const lang = new I18n(translations); |
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,50 @@ | ||
import React from 'react'; | ||
import styles from './ModerationList.css'; | ||
|
||
import I18n from 'coral-framework/modules/i18n/i18n'; | ||
import translations from '../translations.json'; | ||
|
||
import {Icon} from 'react-mdl'; | ||
import ActionButton from './ActionButton'; | ||
|
||
// Render a single comment for the list | ||
const User = props => { | ||
const {action, user} = props; | ||
let userStatus = user.status; | ||
|
||
// Do not display unless the user status is 'pending' or 'banned'. | ||
// This means that they have already been reviewed and approved. | ||
return (userStatus === 'PENDING' || userStatus === 'BANNED') && | ||
<li tabIndex={props.index} className={`mdl-card mdl-shadow--2dp ${styles.listItem} ${props.isActive && !props.hideActive ? styles.activeItem : ''}`}> | ||
<div className={styles.itemHeader}> | ||
<div className={styles.author}> | ||
<span>{user.username}</span> | ||
</div> | ||
<div className={styles.sideActions}> | ||
<div className={`actions ${styles.actions}`}> | ||
{props.modActions.map( | ||
(action, i) => | ||
<ActionButton | ||
type={action.toUpperCase()} | ||
key={i} | ||
user={user} | ||
menuOptionsMap={props.menuOptionsMap} | ||
onClickAction={props.onClickAction} | ||
onClickShowBanDialog={props.onClickShowBanDialog}/> | ||
)} | ||
</div> | ||
</div> | ||
<div> | ||
{userStatus === 'banned' ? | ||
<span className={styles.banned}><Icon name='error_outline'/> {lang.t('comment.banned_user')}</span> : null} | ||
</div> | ||
</div> | ||
<div className={styles.flagCount}> | ||
{`${action.count} ${action.action_type === 'flag_bio' ? lang.t('user.bio_flags') : lang.t('user.username_flags')}`} | ||
</div> | ||
</li>; | ||
}; | ||
|
||
export default User; | ||
|
||
const lang = new I18n(translations); |
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
Oops, something went wrong.