mirror of
https://github.com/wassname/talk.git
synced 2026-07-31 12:50:48 +08:00
Adding banned word list.
This commit is contained in:
@@ -10,21 +10,20 @@ import {
|
||||
Textfield,
|
||||
Checkbox
|
||||
} from 'react-mdl';
|
||||
import {updateSettings} from '../../actions/settings';
|
||||
|
||||
const updateModeration = (props) => () => {
|
||||
const moderation = props.settings.moderation === 'pre' ? 'post' : 'pre';
|
||||
props.dispatch(updateSettings({moderation}));
|
||||
props.updateSettings({moderation});
|
||||
};
|
||||
|
||||
const updateInfoBoxEnable = (props) => () => {
|
||||
const infoBoxEnable = !props.settings.infoBoxEnable;
|
||||
props.dispatch(updateSettings({infoBoxEnable}));
|
||||
props.updateSettings({infoBoxEnable});
|
||||
};
|
||||
|
||||
const updateInfoBoxContent = (props) => (event) => {
|
||||
const infoBoxContent = event.target.value;
|
||||
props.dispatch(updateSettings({infoBoxContent}));
|
||||
props.updateSettings({infoBoxContent});
|
||||
};
|
||||
|
||||
const StateLess = (props) => <List>
|
||||
|
||||
@@ -69,6 +69,19 @@
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
#bannedWordlist {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.bannedWordHeader {
|
||||
font-weight: bold;
|
||||
font-size:18px;
|
||||
margin-bottom:3px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,18 @@ import I18n from 'coral-framework/modules/i18n/i18n';
|
||||
import translations from '../../translations.json';
|
||||
import EmbedLink from './EmbedLink';
|
||||
import CommentSettings from './CommentSettings';
|
||||
import Wordlist from './Wordlist';
|
||||
|
||||
class Configure extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
|
||||
this.state = {activeSection: 'comments'};
|
||||
console.log(props);
|
||||
this.state = {
|
||||
activeSection: 'comments',
|
||||
wordlist: props.settings.wordlist && props.settings.wordlist.join(' ')
|
||||
};
|
||||
this.saveSettings = this.saveSettings.bind(this);
|
||||
this.onChangeWordlist = this.onChangeWordlist.bind(this);
|
||||
}
|
||||
|
||||
componentWillMount () {
|
||||
@@ -34,12 +39,29 @@ class Configure extends React.Component {
|
||||
this.setState({activeSection});
|
||||
}
|
||||
|
||||
onChangeWordlist (event) {
|
||||
event.preventDefault();
|
||||
const newlist = event.target.value;
|
||||
this.setState({wordlist: newlist.toLowerCase()});
|
||||
this.props.dispatch(updateSettings({
|
||||
wordlist: newlist.toLowerCase()
|
||||
.split(',')
|
||||
.map((word) => word.trim())
|
||||
}));
|
||||
}
|
||||
|
||||
getSection (section) {
|
||||
switch(section){
|
||||
case 'comments':
|
||||
return <CommentSettings settings={this.props.settings}/>;
|
||||
return <CommentSettings
|
||||
settings={this.props.settings}
|
||||
updateSettings={(setting) => this.props.dispatch(updateSettings(setting))}/>;
|
||||
case 'embed':
|
||||
return <EmbedLink/>;
|
||||
case 'wordlist':
|
||||
return <Wordlist
|
||||
wordlist={this.state.wordlist}
|
||||
onChangeWordlist={this.onChangeWordlist}/>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {Component} from 'react'
|
||||
import React, {Component} from 'react';
|
||||
import I18n from 'coral-framework/modules/i18n/i18n';
|
||||
import translations from '../../translations.json';
|
||||
import styles from './Configure.css';
|
||||
@@ -44,6 +44,6 @@ class EmbedLink extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default EmbedLink
|
||||
export default EmbedLink;
|
||||
|
||||
const lang = new I18n(translations);
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
import React from 'react'
|
||||
import I18n from 'coral-framework/modules/i18n/i18n';
|
||||
import translations from '../../translations.json';
|
||||
import React from 'react';
|
||||
// import I18n from 'coral-framework/modules/i18n/i18n';
|
||||
// import translations from '../../translations.json';
|
||||
import styles from './Configure.css';
|
||||
import {
|
||||
Card
|
||||
} from 'react-mdl';
|
||||
|
||||
const Wordlist = () => <Card id='bannedWordlist'>
|
||||
<h4 className={styles.bannedWordHeader}>Write the bannned words list</h4>
|
||||
const Wordlist = ({wordlist, onChangeWordlist}) => <Card id={styles.bannedWordlist} shadow={2}>
|
||||
<p className={styles.bannedWordHeader}>Write the bannned words list</p>
|
||||
<p className={styles.bannedWordText}>Comments which contain these words or phrases, not seperated by commas and not
|
||||
case sensitive, will be automatically removed from the comment stream.</p>
|
||||
<textarea
|
||||
rows={5}
|
||||
type='text'
|
||||
className={styles.bannedWordInput}
|
||||
onChange={onChangeWordlist}
|
||||
value={wordlist}/>
|
||||
</Card>;
|
||||
|
||||
export default Wordlist;
|
||||
|
||||
const lang = new I18n(translations);
|
||||
// const lang = new I18n(translations);
|
||||
|
||||
Reference in New Issue
Block a user