summaryrefslogtreecommitdiffstats
path: root/webapp/components/channel_notifications_modal.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/channel_notifications_modal.jsx')
-rw-r--r--webapp/components/channel_notifications_modal.jsx37
1 files changed, 19 insertions, 18 deletions
diff --git a/webapp/components/channel_notifications_modal.jsx b/webapp/components/channel_notifications_modal.jsx
index 59ec40d84..ff6e69f70 100644
--- a/webapp/components/channel_notifications_modal.jsx
+++ b/webapp/components/channel_notifications_modal.jsx
@@ -1,23 +1,23 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import $ from 'jquery';
-import {Modal} from 'react-bootstrap';
-import SettingItemMin from './setting_item_min.jsx';
-import SettingItemMax from './setting_item_max.jsx';
+import SettingItemMin from 'components/setting_item_min.jsx';
+import SettingItemMax from 'components/setting_item_max.jsx';
import Client from 'client/web_client.jsx';
import ChannelStore from 'stores/channel_store.jsx';
-import {FormattedMessage} from 'react-intl';
-
+import $ from 'jquery';
import React from 'react';
+import {Modal} from 'react-bootstrap';
+import {FormattedMessage} from 'react-intl';
export default class ChannelNotificationsModal extends React.Component {
constructor(props) {
super(props);
this.updateSection = this.updateSection.bind(this);
+ this.onHide = this.onHide.bind(this);
this.handleSubmitNotifyLevel = this.handleSubmitNotifyLevel.bind(this);
this.handleUpdateNotifyLevel = this.handleUpdateNotifyLevel.bind(this);
@@ -29,24 +29,23 @@ export default class ChannelNotificationsModal extends React.Component {
this.state = {
activeSection: '',
- notifyLevel: '',
- unreadLevel: ''
+ show: true,
+ notifyLevel: props.channelMember.notify_props.desktop,
+ unreadLevel: props.channelMember.notify_props.mark_unread
};
}
+
updateSection(section) {
if ($('.section-max').length) {
$('.settings-modal .modal-body').scrollTop(0).perfectScrollbar('update');
}
this.setState({activeSection: section});
}
- componentWillReceiveProps(nextProps) {
- if (!this.props.show && nextProps.show) {
- this.setState({
- notifyLevel: nextProps.channelMember.notify_props.desktop,
- unreadLevel: nextProps.channelMember.notify_props.mark_unread
- });
- }
+
+ onHide() {
+ this.setState({show: false});
}
+
handleSubmitNotifyLevel() {
var channelId = this.props.channel.id;
var notifyLevel = this.state.notifyLevel;
@@ -75,9 +74,11 @@ export default class ChannelNotificationsModal extends React.Component {
}
);
}
+
handleUpdateNotifyLevel(notifyLevel) {
this.setState({notifyLevel});
}
+
createNotifyLevelSection(serverError) {
// Get glabal user setting for notifications
const globalNotifyLevel = this.props.currentUser.notify_props ? this.props.currentUser.notify_props.desktop : 'all';
@@ -380,9 +381,10 @@ export default class ChannelNotificationsModal extends React.Component {
return (
<Modal
- show={this.props.show}
+ show={this.state.show}
dialogClassName='settings-modal'
- onHide={this.props.onHide}
+ onHide={this.onHide}
+ onExited={this.props.onHide}
>
<Modal.Header closeButton={true}>
<Modal.Title>
@@ -417,7 +419,6 @@ export default class ChannelNotificationsModal extends React.Component {
}
ChannelNotificationsModal.propTypes = {
- show: React.PropTypes.bool.isRequired,
onHide: React.PropTypes.func.isRequired,
channel: React.PropTypes.object.isRequired,
channelMember: React.PropTypes.object.isRequired,