PLT-2981 Disabled Push Notifications section in Settings if disabled by admin (#3225)

* Added push notifications disabled message to settings

* Update user_settings_notifications.jsx
Этот коммит содержится в:
David Lu
2016-06-04 08:23:44 -07:00
коммит произвёл Joram Wilander
родитель 06b1646798
Коммит 6f0a7e4b13
2 изменённых файлов: 87 добавлений и 63 удалений

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

@@ -263,7 +263,10 @@ class NotificationsTab extends React.Component {
} }
let inputs = []; let inputs = [];
let extraInfo = null;
let submit = null;
if (global.window.mm_config.SendPushNotifications === 'true') {
inputs.push( inputs.push(
<div key='userNotificationLevelOption'> <div key='userNotificationLevelOption'>
<div className='radio'> <div className='radio'>
@@ -290,7 +293,7 @@ class NotificationsTab extends React.Component {
onChange={this.handlePushRadio.bind(this, 'mention')} onChange={this.handlePushRadio.bind(this, 'mention')}
/> />
<FormattedMessage <FormattedMessage
id='user.settings.push_notifications.onlyMentions' id='user.settings.push_notification.onlyMentions'
defaultMessage='For mentions and direct messages' defaultMessage='For mentions and direct messages'
/> />
</label> </label>
@@ -305,7 +308,7 @@ class NotificationsTab extends React.Component {
onChange={this.handlePushRadio.bind(this, 'none')} onChange={this.handlePushRadio.bind(this, 'none')}
/> />
<FormattedMessage <FormattedMessage
id='user.settings.push_notifications.off' id='user.settings.push_notification.off'
defaultMessage='Off' defaultMessage='Off'
/> />
</label> </label>
@@ -313,21 +316,36 @@ class NotificationsTab extends React.Component {
</div> </div>
); );
const extraInfo = ( extraInfo = (
<span> <span>
<FormattedMessage <FormattedMessage
id='user.settings.push_notifications.info' id='user.settings.push_notification.info'
defaultMessage='Notification alerts are pushed to your mobile device when there is activity in Mattermost.' defaultMessage='Notification alerts are pushed to your mobile device when there is activity in Mattermost.'
/> />
</span> </span>
); );
submit = this.handleSubmit();
} else {
inputs.push(
<div
key='oauthEmailInfo'
className='form-group'
>
<FormattedMessage
id='user.settings.push_notification.disabled_long'
defaultMessage='Push notifications for mobile devices have been disabled by your System Administrator.'
/>
</div>
);
}
return ( return (
<SettingItemMax <SettingItemMax
title={Utils.localizeMessage('user.settings.notifications.push', 'Mobile push notifications')} title={Utils.localizeMessage('user.settings.notifications.push', 'Mobile push notifications')}
extraInfo={extraInfo} extraInfo={extraInfo}
inputs={inputs} inputs={inputs}
submit={this.handleSubmit} submit={submit}
server_error={this.state.serverError} server_error={this.state.serverError}
updateSection={this.handleCancel} updateSection={this.handleCancel}
/> />
@@ -345,14 +363,21 @@ class NotificationsTab extends React.Component {
} else if (this.state.notifyPushLevel === 'none') { } else if (this.state.notifyPushLevel === 'none') {
describe = ( describe = (
<FormattedMessage <FormattedMessage
id='user.settings.push_notifications.off' id='user.settings.push_notification.off'
defaultMessage='Off' defaultMessage='Off'
/> />
); );
} else if (global.window.mm_config.SendPushNotifications === 'false') {
describe = (
<FormattedMessage
id='user.settings.push_notification.disabled'
defaultMessage='Disabled by system administrator'
/>
);
} else { } else {
describe = ( describe = (
<FormattedMessage <FormattedMessage
id='user.settings.push_notifications.onlyMentions' id='user.settings.push_notification.onlyMentions'
defaultMessage='For mentions and direct messages' defaultMessage='For mentions and direct messages'
/> />
); );
@@ -364,7 +389,7 @@ class NotificationsTab extends React.Component {
return ( return (
<SettingItemMin <SettingItemMin
title={Utils.localizeMessage('user.settings.notifications.push', 'Mobile push notifications')} title={Utils.localizeMessage('user.settings.notification.push', 'Mobile push notifications')}
describe={describe} describe={describe}
updateSection={handleUpdateDesktopSection} updateSection={handleUpdateDesktopSection}
/> />
@@ -911,10 +936,7 @@ class NotificationsTab extends React.Component {
); );
} }
let pushNotificationSection; const pushNotificationSection = this.createPushNotificationSection();
if (global.window.mm_config.SendPushNotifications === 'true') {
pushNotificationSection = this.createPushNotificationSection();
}
return ( return (
<div> <div>

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

@@ -1393,6 +1393,8 @@
"user.settings.push_notification.info": "Notification alerts are pushed to your mobile device when there is activity in Mattermost.", "user.settings.push_notification.info": "Notification alerts are pushed to your mobile device when there is activity in Mattermost.",
"user.settings.push_notification.off": "Off", "user.settings.push_notification.off": "Off",
"user.settings.push_notification.onlyMentions": "For mentions and direct messages", "user.settings.push_notification.onlyMentions": "For mentions and direct messages",
"user.settings.push_notification.disabled": "Disabled by system administrator",
"user.settings.push_notification.disabled_long": "Push notifications for mobile devices have been disabled by your System Administrator.",
"user.settings.security.close": "Close", "user.settings.security.close": "Close",
"user.settings.security.currentPassword": "Current Password", "user.settings.security.currentPassword": "Current Password",
"user.settings.security.currentPasswordError": "Please enter your current password", "user.settings.security.currentPasswordError": "Please enter your current password",