PLT-3193 Add channel notification preferences for push notifications (#5512)
* PLT-3193 Add channel notification preferences for push and email notifications * Fixing UI * Removing email as preferences from the UI for now * move to action * fix client test
Этот коммит содержится в:
@@ -316,9 +316,13 @@ export function autocompleteChannels(term, success, error) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateChannelNotifyProps(data, success, error) {
|
export function updateChannelNotifyProps(data, options, success, error) {
|
||||||
Client.updateChannelNotifyProps(data,
|
Client.updateChannelNotifyProps(Object.assign({}, data, options),
|
||||||
() => {
|
() => {
|
||||||
|
const member = ChannelStore.getMyMember(data.channel_id);
|
||||||
|
member.notify_props = Object.assign(member.notify_props, options);
|
||||||
|
ChannelStore.storeMyChannelMember(member);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
success();
|
success();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
import SettingItemMin from 'components/setting_item_min.jsx';
|
import SettingItemMin from 'components/setting_item_min.jsx';
|
||||||
import SettingItemMax from 'components/setting_item_max.jsx';
|
import SettingItemMax from 'components/setting_item_max.jsx';
|
||||||
|
|
||||||
import ChannelStore from 'stores/channel_store.jsx';
|
|
||||||
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Modal} from 'react-bootstrap';
|
import {Modal} from 'react-bootstrap';
|
||||||
@@ -20,19 +18,24 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
this.updateSection = this.updateSection.bind(this);
|
this.updateSection = this.updateSection.bind(this);
|
||||||
this.onHide = this.onHide.bind(this);
|
this.onHide = this.onHide.bind(this);
|
||||||
|
|
||||||
this.handleSubmitNotifyLevel = this.handleSubmitNotifyLevel.bind(this);
|
this.handleSubmitDesktopNotifyLevel = this.handleSubmitDesktopNotifyLevel.bind(this);
|
||||||
this.handleUpdateNotifyLevel = this.handleUpdateNotifyLevel.bind(this);
|
this.handleUpdateDesktopNotifyLevel = this.handleUpdateDesktopNotifyLevel.bind(this);
|
||||||
this.createNotifyLevelSection = this.createNotifyLevelSection.bind(this);
|
this.createDesktopNotifyLevelSection = this.createDesktopNotifyLevelSection.bind(this);
|
||||||
|
|
||||||
this.handleSubmitMarkUnreadLevel = this.handleSubmitMarkUnreadLevel.bind(this);
|
this.handleSubmitMarkUnreadLevel = this.handleSubmitMarkUnreadLevel.bind(this);
|
||||||
this.handleUpdateMarkUnreadLevel = this.handleUpdateMarkUnreadLevel.bind(this);
|
this.handleUpdateMarkUnreadLevel = this.handleUpdateMarkUnreadLevel.bind(this);
|
||||||
this.createMarkUnreadLevelSection = this.createMarkUnreadLevelSection.bind(this);
|
this.createMarkUnreadLevelSection = this.createMarkUnreadLevelSection.bind(this);
|
||||||
|
|
||||||
|
this.handleSubmitPushNotificationLevel = this.handleSubmitPushNotificationLevel.bind(this);
|
||||||
|
this.handleUpdatePushNotificationLevel = this.handleUpdatePushNotificationLevel.bind(this);
|
||||||
|
this.createPushNotificationLevelSection = this.createPushNotificationLevelSection.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
activeSection: '',
|
activeSection: '',
|
||||||
show: true,
|
show: true,
|
||||||
notifyLevel: props.channelMember.notify_props.desktop,
|
notifyLevel: props.channelMember.notify_props.desktop,
|
||||||
unreadLevel: props.channelMember.notify_props.mark_unread
|
unreadLevel: props.channelMember.notify_props.mark_unread,
|
||||||
|
pushLevel: props.channelMember.notify_props.push || 'default'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +50,7 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmitNotifyLevel() {
|
handleSubmitDesktopNotifyLevel() {
|
||||||
const channelId = this.props.channel.id;
|
const channelId = this.props.channel.id;
|
||||||
const notifyLevel = this.state.notifyLevel;
|
const notifyLevel = this.state.notifyLevel;
|
||||||
const currentUserId = this.props.currentUser.id;
|
const currentUserId = this.props.currentUser.id;
|
||||||
@@ -57,19 +60,14 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const options = {desktop: notifyLevel};
|
||||||
const data = {
|
const data = {
|
||||||
channel_id: channelId,
|
channel_id: channelId,
|
||||||
user_id: currentUserId,
|
user_id: currentUserId
|
||||||
desktop: notifyLevel
|
|
||||||
};
|
};
|
||||||
|
|
||||||
updateChannelNotifyProps(data,
|
updateChannelNotifyProps(data, options,
|
||||||
() => {
|
() => {
|
||||||
// YUCK
|
|
||||||
var member = ChannelStore.getMyMember(channelId);
|
|
||||||
member.notify_props.desktop = notifyLevel;
|
|
||||||
ChannelStore.storeMyChannelMember(member);
|
|
||||||
|
|
||||||
this.updateSection('');
|
this.updateSection('');
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
@@ -78,11 +76,11 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleUpdateNotifyLevel(notifyLevel) {
|
handleUpdateDesktopNotifyLevel(notifyLevel) {
|
||||||
this.setState({notifyLevel});
|
this.setState({notifyLevel});
|
||||||
}
|
}
|
||||||
|
|
||||||
createNotifyLevelSection(serverError) {
|
createDesktopNotifyLevelSection(serverError) {
|
||||||
// Get glabal user setting for notifications
|
// Get glabal user setting for notifications
|
||||||
const globalNotifyLevel = this.props.currentUser.notify_props ? this.props.currentUser.notify_props.desktop : 'all';
|
const globalNotifyLevel = this.props.currentUser.notify_props ? this.props.currentUser.notify_props.desktop : 'all';
|
||||||
let globalNotifyLevelName;
|
let globalNotifyLevelName;
|
||||||
@@ -140,7 +138,7 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
type='radio'
|
type='radio'
|
||||||
name='desktopNotificationLevel'
|
name='desktopNotificationLevel'
|
||||||
checked={notifyActive[0]}
|
checked={notifyActive[0]}
|
||||||
onChange={this.handleUpdateNotifyLevel.bind(this, 'default')}
|
onChange={this.handleUpdateDesktopNotifyLevel.bind(this, 'default')}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='channel_notifications.globalDefault'
|
id='channel_notifications.globalDefault'
|
||||||
@@ -158,7 +156,7 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
type='radio'
|
type='radio'
|
||||||
name='desktopNotificationLevel'
|
name='desktopNotificationLevel'
|
||||||
checked={notifyActive[1]}
|
checked={notifyActive[1]}
|
||||||
onChange={this.handleUpdateNotifyLevel.bind(this, 'all')}
|
onChange={this.handleUpdateDesktopNotifyLevel.bind(this, 'all')}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage id='channel_notifications.allActivity'/>
|
<FormattedMessage id='channel_notifications.allActivity'/>
|
||||||
</label>
|
</label>
|
||||||
@@ -170,7 +168,7 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
type='radio'
|
type='radio'
|
||||||
name='desktopNotificationLevel'
|
name='desktopNotificationLevel'
|
||||||
checked={notifyActive[2]}
|
checked={notifyActive[2]}
|
||||||
onChange={this.handleUpdateNotifyLevel.bind(this, 'mention')}
|
onChange={this.handleUpdateDesktopNotifyLevel.bind(this, 'mention')}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage id='channel_notifications.onlyMentions'/>
|
<FormattedMessage id='channel_notifications.onlyMentions'/>
|
||||||
</label>
|
</label>
|
||||||
@@ -182,7 +180,7 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
type='radio'
|
type='radio'
|
||||||
name='desktopNotificationLevel'
|
name='desktopNotificationLevel'
|
||||||
checked={notifyActive[3]}
|
checked={notifyActive[3]}
|
||||||
onChange={this.handleUpdateNotifyLevel.bind(this, 'none')}
|
onChange={this.handleUpdateDesktopNotifyLevel.bind(this, 'none')}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage id='channel_notifications.never'/>
|
<FormattedMessage id='channel_notifications.never'/>
|
||||||
</label>
|
</label>
|
||||||
@@ -208,7 +206,7 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
<SettingItemMax
|
<SettingItemMax
|
||||||
title={sendDesktop}
|
title={sendDesktop}
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleSubmitNotifyLevel}
|
submit={this.handleSubmitDesktopNotifyLevel}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
updateSection={handleUpdateSection}
|
updateSection={handleUpdateSection}
|
||||||
extraInfo={extraInfo}
|
extraInfo={extraInfo}
|
||||||
@@ -254,18 +252,14 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const options = {mark_unread: markUnreadLevel};
|
||||||
const data = {
|
const data = {
|
||||||
channel_id: channelId,
|
channel_id: channelId,
|
||||||
user_id: this.props.currentUser.id,
|
user_id: this.props.currentUser.id
|
||||||
mark_unread: markUnreadLevel
|
|
||||||
};
|
};
|
||||||
|
|
||||||
updateChannelNotifyProps(data,
|
updateChannelNotifyProps(data, options,
|
||||||
() => {
|
() => {
|
||||||
// Yuck...
|
|
||||||
var member = ChannelStore.getMyMember(channelId);
|
|
||||||
member.notify_props.mark_unread = markUnreadLevel;
|
|
||||||
ChannelStore.storeMyChannelMember(member);
|
|
||||||
this.updateSection('');
|
this.updateSection('');
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
@@ -375,8 +369,213 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleSubmitPushNotificationLevel() {
|
||||||
|
const channelId = this.props.channel.id;
|
||||||
|
const notifyLevel = this.state.pushLevel;
|
||||||
|
const currentUserId = this.props.currentUser.id;
|
||||||
|
|
||||||
|
if (this.props.channelMember.notify_props.push === notifyLevel) {
|
||||||
|
this.updateSection('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = {push: notifyLevel};
|
||||||
|
const data = {
|
||||||
|
channel_id: channelId,
|
||||||
|
user_id: currentUserId
|
||||||
|
};
|
||||||
|
|
||||||
|
updateChannelNotifyProps(data, options,
|
||||||
|
() => {
|
||||||
|
this.updateSection('');
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
this.setState({serverError: err.message});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleUpdatePushNotificationLevel(pushLevel) {
|
||||||
|
this.setState({pushLevel});
|
||||||
|
}
|
||||||
|
|
||||||
|
createPushNotificationLevelSection(serverError) {
|
||||||
|
if (global.mm_config.SendPushNotifications === 'false') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get glabal user setting for notifications
|
||||||
|
const globalNotifyLevel = this.props.currentUser.notify_props ? this.props.currentUser.notify_props.push : 'all';
|
||||||
|
let globalNotifyLevelName;
|
||||||
|
if (globalNotifyLevel === 'all') {
|
||||||
|
globalNotifyLevelName = (
|
||||||
|
<FormattedMessage
|
||||||
|
id='channel_notifications.allActivity'
|
||||||
|
defaultMessage='For all activity'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else if (globalNotifyLevel === 'mention') {
|
||||||
|
globalNotifyLevelName = (
|
||||||
|
<FormattedMessage
|
||||||
|
id='channel_notifications.onlyMentions'
|
||||||
|
defaultMessage='Only for mentions'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
globalNotifyLevelName = (
|
||||||
|
<FormattedMessage
|
||||||
|
id='channel_notifications.never'
|
||||||
|
defaultMessage='Never'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendPushNotifications = (
|
||||||
|
<FormattedMessage
|
||||||
|
id='channel_notifications.push'
|
||||||
|
defaultMessage='Send mobile push notifications'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
const notificationLevel = this.state.pushLevel;
|
||||||
|
|
||||||
|
let content;
|
||||||
|
if (this.state.activeSection === 'push') {
|
||||||
|
const notifyActive = [false, false, false, false];
|
||||||
|
if (notificationLevel === 'default') {
|
||||||
|
notifyActive[0] = true;
|
||||||
|
} else if (notificationLevel === 'all') {
|
||||||
|
notifyActive[1] = true;
|
||||||
|
} else if (notificationLevel === 'mention') {
|
||||||
|
notifyActive[2] = true;
|
||||||
|
} else {
|
||||||
|
notifyActive[3] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const inputs = [];
|
||||||
|
|
||||||
|
inputs.push(
|
||||||
|
<div key='channel-notification-level-radio'>
|
||||||
|
<div className='radio'>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type='radio'
|
||||||
|
name='pushNotificationLevel'
|
||||||
|
checked={notifyActive[0]}
|
||||||
|
onChange={this.handleUpdatePushNotificationLevel.bind(this, 'default')}
|
||||||
|
/>
|
||||||
|
<FormattedMessage
|
||||||
|
id='channel_notifications.globalDefault'
|
||||||
|
defaultMessage='Global default ({notifyLevel})'
|
||||||
|
values={{
|
||||||
|
notifyLevel: (globalNotifyLevelName)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<div className='radio'>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type='radio'
|
||||||
|
name='pushNotificationLevel'
|
||||||
|
checked={notifyActive[1]}
|
||||||
|
onChange={this.handleUpdatePushNotificationLevel.bind(this, 'all')}
|
||||||
|
/>
|
||||||
|
<FormattedMessage id='channel_notifications.allActivity'/>
|
||||||
|
</label>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<div className='radio'>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type='radio'
|
||||||
|
name='pushNotificationLevel'
|
||||||
|
checked={notifyActive[2]}
|
||||||
|
onChange={this.handleUpdatePushNotificationLevel.bind(this, 'mention')}
|
||||||
|
/>
|
||||||
|
<FormattedMessage id='channel_notifications.onlyMentions'/>
|
||||||
|
</label>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<div className='radio'>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type='radio'
|
||||||
|
name='pushNotificationLevel'
|
||||||
|
checked={notifyActive[3]}
|
||||||
|
onChange={this.handleUpdatePushNotificationLevel.bind(this, 'none')}
|
||||||
|
/>
|
||||||
|
<FormattedMessage id='channel_notifications.never'/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleUpdateSection = function updateSection(e) {
|
||||||
|
this.updateSection('');
|
||||||
|
e.preventDefault();
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
const extraInfo = (
|
||||||
|
<span>
|
||||||
|
<FormattedMessage
|
||||||
|
id='channel_notifications.overridePush'
|
||||||
|
defaultMessage='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.'
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
|
||||||
|
content = (
|
||||||
|
<SettingItemMax
|
||||||
|
title={sendPushNotifications}
|
||||||
|
inputs={inputs}
|
||||||
|
submit={this.handleSubmitPushNotificationLevel}
|
||||||
|
server_error={serverError}
|
||||||
|
updateSection={handleUpdateSection}
|
||||||
|
extraInfo={extraInfo}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
let describe;
|
||||||
|
if (notificationLevel === 'default') {
|
||||||
|
describe = (
|
||||||
|
<FormattedMessage
|
||||||
|
id='channel_notifications.globalDefault'
|
||||||
|
values={{
|
||||||
|
notifyLevel: (globalNotifyLevelName)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else if (notificationLevel === 'mention') {
|
||||||
|
describe = (<FormattedMessage id='channel_notifications.onlyMentions'/>);
|
||||||
|
} else if (notificationLevel === 'all') {
|
||||||
|
describe = (<FormattedMessage id='channel_notifications.allActivity'/>);
|
||||||
|
} else {
|
||||||
|
describe = (<FormattedMessage id='channel_notifications.never'/>);
|
||||||
|
}
|
||||||
|
|
||||||
|
content = (
|
||||||
|
<SettingItemMin
|
||||||
|
title={sendPushNotifications}
|
||||||
|
describe={describe}
|
||||||
|
updateSection={() => {
|
||||||
|
this.updateSection('push');
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className='divider-light'/>
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var serverError = null;
|
let serverError = null;
|
||||||
if (this.state.serverError) {
|
if (this.state.serverError) {
|
||||||
serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
|
serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
|
||||||
}
|
}
|
||||||
@@ -406,7 +605,8 @@ export default class ChannelNotificationsModal extends React.Component {
|
|||||||
>
|
>
|
||||||
<br/>
|
<br/>
|
||||||
<div className='divider-dark first'/>
|
<div className='divider-dark first'/>
|
||||||
{this.createNotifyLevelSection(serverError)}
|
{this.createDesktopNotifyLevelSection(serverError)}
|
||||||
|
{this.createPushNotificationLevelSection(serverError)}
|
||||||
<div className='divider-light'/>
|
<div className='divider-light'/>
|
||||||
{this.createMarkUnreadLevelSection(serverError)}
|
{this.createMarkUnreadLevelSection(serverError)}
|
||||||
<div className='divider-dark'/>
|
<div className='divider-dark'/>
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ import SettingItemMax from 'components/setting_item_max.jsx';
|
|||||||
|
|
||||||
import {Preferences} from 'utils/constants.jsx';
|
import {Preferences} from 'utils/constants.jsx';
|
||||||
|
|
||||||
const INTERVAL_IMMEDIATE = 30; // "immediate" is a 30 second interval
|
|
||||||
const INTERVAL_FIFTEEN_MINUTES = 15 * 60;
|
|
||||||
const INTERVAL_HOUR = 60 * 60;
|
|
||||||
|
|
||||||
export default class EmailNotificationSetting extends React.Component {
|
export default class EmailNotificationSetting extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
activeSection: React.PropTypes.string.isRequired,
|
activeSection: React.PropTypes.string.isRequired,
|
||||||
@@ -36,7 +32,7 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
this.collapse = this.collapse.bind(this);
|
this.collapse = this.collapse.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
emailInterval: PreferenceStore.getInt(Preferences.CATEGORY_NOTIFICATIONS, Preferences.EMAIL_INTERVAL, INTERVAL_IMMEDIATE)
|
emailInterval: PreferenceStore.getInt(Preferences.CATEGORY_NOTIFICATIONS, Preferences.EMAIL_INTERVAL, Preferences.INTERVAL_IMMEDIATE)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +62,7 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
|
|
||||||
if (this.props.enableEmail) {
|
if (this.props.enableEmail) {
|
||||||
switch (this.state.emailInterval) {
|
switch (this.state.emailInterval) {
|
||||||
case INTERVAL_IMMEDIATE:
|
case Preferences.INTERVAL_IMMEDIATE:
|
||||||
description = (
|
description = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.email.immediately'
|
id='user.settings.notifications.email.immediately'
|
||||||
@@ -74,7 +70,7 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case INTERVAL_HOUR:
|
case Preferences.INTERVAL_HOUR:
|
||||||
description = (
|
description = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.email.everyHour'
|
id='user.settings.notifications.email.everyHour'
|
||||||
@@ -119,13 +115,13 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
<input
|
<input
|
||||||
type='radio'
|
type='radio'
|
||||||
name='emailNotifications'
|
name='emailNotifications'
|
||||||
checked={this.props.enableEmail && this.state.emailInterval === INTERVAL_FIFTEEN_MINUTES}
|
checked={this.props.enableEmail && this.state.emailInterval === Preferences.INTERVAL_FIFTEEN_MINUTES}
|
||||||
onChange={this.handleChange.bind(this, 'true', INTERVAL_FIFTEEN_MINUTES)}
|
onChange={this.handleChange.bind(this, 'true', Preferences.INTERVAL_FIFTEEN_MINUTES)}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.email.everyXMinutes'
|
id='user.settings.notifications.email.everyXMinutes'
|
||||||
defaultMessage='Every {count} minutes'
|
defaultMessage='Every {count} minutes'
|
||||||
values={{count: INTERVAL_FIFTEEN_MINUTES / 60}}
|
values={{count: Preferences.INTERVAL_FIFTEEN_MINUTES / 60}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -134,8 +130,8 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
<input
|
<input
|
||||||
type='radio'
|
type='radio'
|
||||||
name='emailNotifications'
|
name='emailNotifications'
|
||||||
checked={this.props.enableEmail && this.state.emailInterval === INTERVAL_HOUR}
|
checked={this.props.enableEmail && this.state.emailInterval === Preferences.INTERVAL_HOUR}
|
||||||
onChange={this.handleChange.bind(this, 'true', INTERVAL_HOUR)}
|
onChange={this.handleChange.bind(this, 'true', Preferences.INTERVAL_HOUR)}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.email.everyHour'
|
id='user.settings.notifications.email.everyHour'
|
||||||
@@ -170,8 +166,8 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
<input
|
<input
|
||||||
type='radio'
|
type='radio'
|
||||||
name='emailNotifications'
|
name='emailNotifications'
|
||||||
checked={this.props.enableEmail && this.state.emailInterval === INTERVAL_IMMEDIATE}
|
checked={this.props.enableEmail && this.state.emailInterval === Preferences.INTERVAL_IMMEDIATE}
|
||||||
onChange={this.handleChange.bind(this, 'true', INTERVAL_IMMEDIATE)}
|
onChange={this.handleChange.bind(this, 'true', Preferences.INTERVAL_IMMEDIATE)}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.email.immediately'
|
id='user.settings.notifications.email.immediately'
|
||||||
@@ -186,7 +182,7 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
type='radio'
|
type='radio'
|
||||||
name='emailNotifications'
|
name='emailNotifications'
|
||||||
checked={!this.props.enableEmail}
|
checked={!this.props.enableEmail}
|
||||||
onChange={this.handleChange.bind(this, 'false', INTERVAL_IMMEDIATE)}
|
onChange={this.handleChange.bind(this, 'false', Preferences.INTERVAL_IMMEDIATE)}
|
||||||
/>
|
/>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.email.never'
|
id='user.settings.notifications.email.never'
|
||||||
|
|||||||
@@ -1143,7 +1143,9 @@
|
|||||||
"channel_notifications.never": "Never",
|
"channel_notifications.never": "Never",
|
||||||
"channel_notifications.onlyMentions": "Only for mentions",
|
"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.override": "Selecting an option other than \"Default\" will override the global notification settings. Desktop notifications are available on Firefox, Safari, and Chrome.",
|
||||||
|
"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_notifications.preferences": "Notification Preferences for ",
|
||||||
|
"channel_notification.push": "Send mobile push notifications",
|
||||||
"channel_notifications.sendDesktop": "Send desktop 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_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 ---",
|
"channel_select.placeholder": "--- Select a channel ---",
|
||||||
|
|||||||
@@ -55,7 +55,10 @@ export const Preferences = {
|
|||||||
CATEGORY_FLAGGED_POST: 'flagged_post',
|
CATEGORY_FLAGGED_POST: 'flagged_post',
|
||||||
CATEGORY_NOTIFICATIONS: 'notifications',
|
CATEGORY_NOTIFICATIONS: 'notifications',
|
||||||
CATEGORY_FAVORITE_CHANNEL: 'favorite_channel',
|
CATEGORY_FAVORITE_CHANNEL: 'favorite_channel',
|
||||||
EMAIL_INTERVAL: 'email_interval'
|
EMAIL_INTERVAL: 'email_interval',
|
||||||
|
INTERVAL_IMMEDIATE: 30, // "immediate" is a 30 second interval
|
||||||
|
INTERVAL_FIFTEEN_MINUTES: 15 * 60,
|
||||||
|
INTERVAL_HOUR: 60 * 60
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ActionTypes = keyMirror({
|
export const ActionTypes = keyMirror({
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user