Merge pull request #587 from nickago/MM-1899

MM-1899 Added help text to channel notifications
Этот коммит содержится в:
Christopher Speller
2015-09-03 15:30:32 -04:00
родитель e69e2db6b4 32eab0e704
Коммит 2a62b00d76
3 изменённых файлов: 10 добавлений и 14 удалений

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

@@ -162,6 +162,13 @@ export default class ChannelNotifications extends React.Component {
e.preventDefault(); e.preventDefault();
}.bind(this); }.bind(this);
let curChannel = ChannelStore.get(this.state.channelId);
let extraInfo = (<span>These settings will override the global notification settings</span>);
if (curChannel && curChannel.display_name) {
extraInfo = (<span>These settings will override the global notification settings for the <b>{curChannel.display_name}</b> channel</span>);
}
return ( return (
<SettingItemMax <SettingItemMax
title='Send desktop notifications' title='Send desktop notifications'
@@ -169,6 +176,7 @@ export default class ChannelNotifications extends React.Component {
submit={this.handleUpdate} submit={this.handleUpdate}
server_error={serverError} server_error={serverError}
updateSection={handleUpdateSection} updateSection={handleUpdateSection}
extraInfo={extraInfo}
/> />
); );
} }

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

@@ -15,7 +15,7 @@ export default class SettingItemMax extends React.Component {
var extraInfo = null; var extraInfo = null;
if (this.props.extraInfo) { if (this.props.extraInfo) {
extraInfo = this.props.extraInfo; extraInfo = (<div className='setting-list__hint'>{this.props.extraInfo}</div>);
} }
var submit = ''; var submit = '';

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

@@ -1,7 +1,6 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information. // See License.txt for license information.
var ChannelStore = require('../stores/channel_store.jsx');
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
var SettingItemMin = require('./setting_item_min.jsx'); var SettingItemMin = require('./setting_item_min.jsx');
var SettingItemMax = require('./setting_item_max.jsx'); var SettingItemMax = require('./setting_item_max.jsx');
@@ -69,11 +68,9 @@ function getNotificationsStateFromStores() {
} }
} }
var curChannel = ChannelStore.getCurrent().display_name;
return {notifyLevel: desktop, enableEmail: email, soundNeeded: soundNeeded, enableSound: sound, return {notifyLevel: desktop, enableEmail: email, soundNeeded: soundNeeded, enableSound: sound,
usernameKey: usernameKey, mentionKey: mentionKey, customKeys: customKeys, customKeysChecked: customKeys.length > 0, usernameKey: usernameKey, mentionKey: mentionKey, customKeys: customKeys, customKeysChecked: customKeys.length > 0,
firstNameKey: firstNameKey, allKey: allKey, channelKey: channelKey, curChannel: curChannel}; firstNameKey: firstNameKey, allKey: allKey, channelKey: channelKey};
} }
export default class NotificationsTab extends React.Component { export default class NotificationsTab extends React.Component {
@@ -147,12 +144,10 @@ export default class NotificationsTab extends React.Component {
} }
componentDidMount() { componentDidMount() {
UserStore.addChangeListener(this.onListenerChange); UserStore.addChangeListener(this.onListenerChange);
ChannelStore.addChangeListener(this.onListenerChange);
$('#user_settings').on('hidden.bs.modal', this.handleClose); $('#user_settings').on('hidden.bs.modal', this.handleClose);
} }
componentWillUnmount() { componentWillUnmount() {
UserStore.removeChangeListener(this.onListenerChange); UserStore.removeChangeListener(this.onListenerChange);
ChannelStore.removeChangeListener(this.onListenerChange);
$('#user_settings').off('hidden.bs.modal', this.handleClose); $('#user_settings').off('hidden.bs.modal', this.handleClose);
this.props.updateSection(''); this.props.updateSection('');
} }
@@ -271,12 +266,6 @@ export default class NotificationsTab extends React.Component {
e.preventDefault(); e.preventDefault();
}.bind(this); }.bind(this);
let extraInfo = (
<div className='setting-list__hint'>
These settings will override the global notification settings for the <b>{this.state.curChannel}</b> channel
</div>
);
desktopSection = ( desktopSection = (
<SettingItemMax <SettingItemMax
title='Send desktop notifications' title='Send desktop notifications'
@@ -284,7 +273,6 @@ export default class NotificationsTab extends React.Component {
submit={this.handleSubmit} submit={this.handleSubmit}
server_error={serverError} server_error={serverError}
updateSection={handleUpdateDesktopSection} updateSection={handleUpdateDesktopSection}
extraInfo={extraInfo}
/> />
); );
} else { } else {