Skip to content

Commit

Permalink
Fixing UI
Browse files Browse the repository at this point in the history
  • Loading branch information
enahum committed Feb 23, 2017
1 parent 623104d commit 6f75478
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 50 deletions.
61 changes: 14 additions & 47 deletions webapp/components/channel_notifications_modal.jsx
Expand Up @@ -5,15 +5,13 @@ import SettingItemMin from 'components/setting_item_min.jsx';
import SettingItemMax from 'components/setting_item_max.jsx';

import ChannelStore from 'stores/channel_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';

import $ from 'jquery';
import React from 'react';
import {Modal} from 'react-bootstrap';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';

import {updateChannelNotifyProps} from 'actions/channel_actions.jsx';
import {Preferences} from 'utils/constants.jsx';

export default class ChannelNotificationsModal extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -429,59 +427,28 @@ export default class ChannelNotificationsModal extends React.Component {

// Get glabal user setting for notifications
const globalNotifyLevel = this.props.currentUser.notify_props ? this.props.currentUser.notify_props.email : 'true';
const emailInterval = PreferenceStore.getInt(Preferences.CATEGORY_NOTIFICATIONS, Preferences.EMAIL_INTERVAL, Preferences.INTERVAL_IMMEDIATE);

let globalNotifyLevelName;
let dynamicOptionName;
if (globalNotifyLevel === 'false') {
globalNotifyLevelName = (
<FormattedMessage
id='user.settings.notifications.email.never'
defaultMessage='Never'
id='channel_notifications.off'
defaultMessage='Off'
/>
);

dynamicOptionName = (
} else {
globalNotifyLevelName = (
<FormattedMessage
id='user.settings.notifications.email.immediately'
defaultMessage='Immediately'
id='channel_notifications.on'
defaultMessage='On'
/>
);
} else {
switch (emailInterval) {
case Preferences.INTERVAL_IMMEDIATE:
globalNotifyLevelName = (
<FormattedMessage
id='user.settings.notifications.email.immediately'
defaultMessage='Immediately'
/>
);
break;
case Preferences.INTERVAL_HOUR:
globalNotifyLevelName = (
<FormattedMessage
id='user.settings.notifications.email.everyHour'
defaultMessage='Every hour'
/>
);
break;
default:
globalNotifyLevelName = (
<FormattedMessage
id='user.settings.notifications.email.everyXMinutes'
defaultMessage='Every {count, plural, one {minute} other {{count, number} minutes}}'
values={{count: emailInterval / 60}}
/>
);
}

dynamicOptionName = globalNotifyLevelName;
}

const sendEmailNotifications = (
<FormattedMessage
id='channel_notifications.email'
defaultMessage='Email notifications'
defaultMessage='Send email notifications'
/>
);

Expand Down Expand Up @@ -528,7 +495,7 @@ export default class ChannelNotificationsModal extends React.Component {
checked={notifyActive[1]}
onChange={this.handleUpdateEmailNotification.bind(this, 'true')}
/>
{dynamicOptionName}
<FormattedMessage id='channel_notifications.on'/>
</label>
<br/>
</div>
Expand All @@ -540,7 +507,7 @@ export default class ChannelNotificationsModal extends React.Component {
checked={notifyActive[2]}
onChange={this.handleUpdateEmailNotification.bind(this, 'false')}
/>
<FormattedMessage id='channel_notifications.never'/>
<FormattedMessage id='channel_notifications.off'/>
</label>
</div>
</div>
Expand All @@ -555,7 +522,7 @@ export default class ChannelNotificationsModal extends React.Component {
<span>
<FormattedHTMLMessage
id='channel_notifications.overrideEmail'
defaultMessage='To change the global default, go to <strong>Account Settings > Notifications > Email notifications<strong>.'
defaultMessage='If on, email notifications are sent for mentions and direct messages when you are offline or away from Mattermost for more than 5 minutes. To change the global default, go to <strong>Account Settings > Notifications > Email notifications<strong>.'
/>
</span>
);
Expand All @@ -582,7 +549,7 @@ export default class ChannelNotificationsModal extends React.Component {
/>
);
} else if (notificationLevel === 'true') {
describe = dynamicOptionName;
describe = (<FormattedMessage id='channel_notifications.on'/>);
} else if (notificationLevel === 'false') {
describe = (<FormattedMessage id='channel_notifications.never'/>);
}
Expand Down Expand Up @@ -675,7 +642,7 @@ export default class ChannelNotificationsModal extends React.Component {
const sendPushNotifications = (
<FormattedMessage
id='channel_notifications.push'
defaultMessage='Mobile push notifications'
defaultMessage='Send mobile push notifications'
/>
);

Expand Down Expand Up @@ -848,10 +815,10 @@ export default class ChannelNotificationsModal extends React.Component {
<br/>
<div className='divider-dark first'/>
{this.createDesktopNotifyLevelSection(serverError)}
<div className='divider-light'/>
{this.createMarkUnreadLevelSection(serverError)}
{this.createEmailNotificationSection(serverError)}
{this.createPushNotificationLevelSection(serverError)}
<div className='divider-light'/>
{this.createMarkUnreadLevelSection(serverError)}
<div className='divider-dark'/>
</div>
</div>
Expand Down
8 changes: 5 additions & 3 deletions webapp/i18n/en.json
Expand Up @@ -1136,16 +1136,18 @@
"channel_modal.purposeEx": "E.g.: \"A channel to file bugs and improvements\"",
"channel_notifications.allActivity": "For all activity",
"channel_notifications.allUnread": "For all unread messages",
"channel_notifications.email": "Email notifications",
"channel_notifications.email": "Send email notifications",
"channel_notifications.globalDefault": "Global default ({notifyLevel})",
"channel_notifications.markUnread": "Mark Channel Unread",
"channel_notifications.never": "Never",
"channel_notifications.off": "Off",
"channel_notifications.on": "On",
"channel_notifications.onlyMentions": "Only for mentions",
"channel_notifications.override": "Selecting an option other than \"Default\" will override the global notification settings. Desktop notifications are available on Firefox, Safari, and Chrome.",
"channel_notifications.overrideEmail": "To change the global default, go to <strong>Account Settings > Notifications > Email notifications<strong>.",
"channel_notifications.overrideEmail": "If on, email notifications are sent for mentions and direct messages when you are offline or away from Mattermost for more than 5 minutes. To change the global default, go to <strong>Account Settings > Notifications > Email notifications<strong>.",
"channel_notifications.overridePush": "Selecting an option other than \"Global default\" will override the global notification settings for mobile push notifications in account settings. Push notifications must be enabled by the System Admin.",
"channel_notifications.preferences": "Notification Preferences for ",
"channel_notification.push": "Mobile push notifications",
"channel_notification.push": "Send mobile push notifications",
"channel_notifications.sendDesktop": "Send desktop notifications",
"channel_notifications.unreadInfo": "The channel name is bolded in the sidebar when there are unread messages. Selecting \"Only for mentions\" will bold the channel only when you are mentioned.",
"channel_select.placeholder": "--- Select a channel ---",
Expand Down

0 comments on commit 6f75478

Please sign in to comment.