From 4bc625e8d10ab7735b76814fe9bbf3fb9144d4e1 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Tue, 22 Sep 2015 12:00:34 -0400 Subject: Added 'default' option to channel notification settings that just uses the user's notification level --- web/react/components/channel_notifications.jsx | 67 ++++++++++++++-------- web/react/components/sidebar.jsx | 14 +++-- .../user_settings/user_settings_notifications.jsx | 2 +- 3 files changed, 52 insertions(+), 31 deletions(-) (limited to 'web/react') diff --git a/web/react/components/channel_notifications.jsx b/web/react/components/channel_notifications.jsx index 9eda68b38..347d02478 100644 --- a/web/react/components/channel_notifications.jsx +++ b/web/react/components/channel_notifications.jsx @@ -104,14 +104,28 @@ export default class ChannelNotifications extends React.Component { createDesktopSection(serverError) { var handleUpdateSection; + const user = UserStore.getCurrentUser(); + const globalNotifyLevel = user.notify_props.desktop; + + let globalNotifyLevelName; + if (globalNotifyLevel === 'all') { + globalNotifyLevelName = 'For all activity'; + } else if (globalNotifyLevel === 'mention') { + globalNotifyLevelName = 'Only for mentions'; + } else { + globalNotifyLevelName = 'Never'; + } + if (this.state.activeSection === 'desktop') { - var notifyActive = [false, false, false]; - if (this.state.notifyLevel === 'mention') { - notifyActive[1] = true; - } else if (this.state.notifyLevel === 'all') { + var notifyActive = [false, false, false, false]; + if (this.state.notifyLevel === 'default') { notifyActive[0] = true; - } else { + } else if (this.state.notifyLevel === 'all') { + notifyActive[1] = true; + } else if (this.state.notifyLevel === 'mention') { notifyActive[2] = true; + } else { + notifyActive[3] = true; } var inputs = []; @@ -123,9 +137,9 @@ export default class ChannelNotifications extends React.Component { - For all activity + {`Global default (${globalNotifyLevelName})`}
@@ -135,9 +149,9 @@ export default class ChannelNotifications extends React.Component { - Only for mentions + {'For all activity'}
@@ -147,9 +161,21 @@ export default class ChannelNotifications extends React.Component { + {'Only for mentions'} + + +
+ +
+
@@ -162,25 +188,14 @@ export default class ChannelNotifications extends React.Component { e.preventDefault(); }.bind(this); - let curChannel = ChannelStore.get(this.state.channelId); - let extraInfo = ( + const extraInfo = ( - These settings will override the global notification settings. + {'Selecting an option other than "Default" will override the global notification settings.'}
- Desktop notifications are available on Firefox, Safari, and Chrome. + {'Desktop notifications are available on Firefox, Safari, and Chrome.'}
); - if (curChannel && curChannel.display_name) { - extraInfo = ( - - These settings will override the global notification settings for the {curChannel.display_name} channel. -
- Desktop notifications are available on Firefox, Safari, and Chrome. -
- ); - } - return (