mirror of
https://github.com/wassname/talk.git
synced 2026-07-04 08:46:13 +08:00
Reloading banned word list from settings.
This commit is contained in:
@@ -18,10 +18,9 @@ import Wordlist from './Wordlist';
|
||||
class Configure extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
console.log(props);
|
||||
this.state = {
|
||||
activeSection: 'comments',
|
||||
wordlist: props.settings.wordlist && props.settings.wordlist.join(' '),
|
||||
wordlist: [],
|
||||
changed: false
|
||||
};
|
||||
this.saveSettings = this.saveSettings.bind(this);
|
||||
@@ -33,8 +32,18 @@ class Configure extends React.Component {
|
||||
this.props.dispatch(fetchSettings());
|
||||
}
|
||||
|
||||
componentWillUpdate (newProps) {
|
||||
if ((!this.props.settings
|
||||
|| !this.props.settings.wordlist)
|
||||
&& newProps.settings.wordlist
|
||||
&& newProps.settings.wordlist.length !== 0 ) {
|
||||
this.setState({wordlist: newProps.settings.wordlist.join(', ')});
|
||||
}
|
||||
}
|
||||
|
||||
saveSettings () {
|
||||
this.props.dispatch(saveSettingsToServer());
|
||||
this.setState({changed: false});
|
||||
}
|
||||
|
||||
changeSection (activeSection) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as actions from '../actions/items';
|
||||
const initialState = fromJS({
|
||||
comments: {},
|
||||
users: {},
|
||||
actions: {}
|
||||
actions: {}
|
||||
});
|
||||
|
||||
export default (state = initialState, action) => {
|
||||
@@ -17,7 +17,6 @@ export default (state = initialState, action) => {
|
||||
return state.setIn([action.item_type, action.id, action.property], fromJS(action.value));
|
||||
case actions.APPEND_ITEM_ARRAY:
|
||||
return state.updateIn([action.item_type, action.id, action.property], (prop) => {
|
||||
console.log(prop);
|
||||
if (action.add_to_front) {
|
||||
return prop ? prop.unshift(fromJS(action.value)) : fromJS([action.value]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user