Fixed regression with setting channel notification settings

Этот коммит содержится в:
Reed Garmsen
2015-11-24 09:46:51 -08:00
родитель da194941b6
Коммит f76f20b256

Просмотреть файл

@@ -28,7 +28,7 @@ export default class ChannelNotificationsModal extends React.Component {
this.state = { this.state = {
notifyLevel: member.notify_props.desktop, notifyLevel: member.notify_props.desktop,
markUnreadLevel: member.notify_props.mark_unread, markUnreadLevel: member.notify_props.mark_unread,
channelId: '', channelId: ChannelStore.getCurrentId(),
activeSection: '' activeSection: ''
}; };
} }
@@ -39,18 +39,21 @@ export default class ChannelNotificationsModal extends React.Component {
ChannelStore.removeChangeListener(this.onListenerChange); ChannelStore.removeChangeListener(this.onListenerChange);
} }
onListenerChange() { onListenerChange() {
if (!this.state.channelId) { const curChannelId = ChannelStore.getCurrentId();
if (!curChannelId) {
return; return;
} }
const member = ChannelStore.getMember(this.state.channelId); const newState = {channelId: curChannelId};
const member = ChannelStore.getMember(curChannelId);
if (member.notify_props.desktop !== this.state.notifyLevel || member.notify_props.mark_unread !== this.state.mark_unread) { if (member.notify_props.desktop !== this.state.notifyLevel || member.notify_props.mark_unread !== this.state.mark_unread) {
this.setState({ newState.notifyLevel = member.notify_props.desktop;
notifyLevel: member.notify_props.desktop, newState.markUnreadLevel = member.notify_props.mark_unread;
markUnreadLevel: member.notify_props.mark_unread
});
} }
this.setState(newState);
} }
updateSection(section) { updateSection(section) {
this.setState({activeSection: section}); this.setState({activeSection: section});