Reloading banned word list from settings.

This commit is contained in:
David Jay
2016-12-01 21:12:13 -05:00
parent a91b73e94a
commit 2cb439ccf8
2 changed files with 12 additions and 4 deletions
@@ -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) {
+1 -2
View File
@@ -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 {