PLT-6823 Removes option to set notification sound in Edge (#6883)

* Remove sound notification support for Edge

* Move the sound test to utils and also stop the dings for Edge along with firefox

* Fix some styling issues

* Remove sound notification support for Edge

Move the sound test to utils and also stop the dings for Edge along with firefox

Fix some styling issues

* Reversing soundOptions util method. Fixing some string IDs for clarity

* Fixing a syntax error

* Restructure HasSoundOptions blocks to not begin with negative statement

* Fixing paranthesis
Этот коммит содержится в:
Alex White
2017-08-03 09:03:51 -05:00
коммит произвёл Harrison Healey
родитель ea095d6206
Коммит 3174c9a07d
3 изменённых файлов: 51 добавлений и 48 удалений

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

@@ -5,7 +5,6 @@ import SettingItemMin from 'components/setting_item_min.jsx';
import SettingItemMax from 'components/setting_item_max.jsx';
import * as Utils from 'utils/utils.jsx';
import * as UserAgent from 'utils/user_agent.jsx';
import PropTypes from 'prop-types';
@@ -45,24 +44,7 @@ export default class DesktopNotificationSettings extends React.Component {
soundRadio[0] = true;
}
if (UserAgent.isFirefox()) {
soundSection = (
<div>
<hr/>
<label>
<FormattedMessage
id='user.settings.notifications.desktop.sound'
defaultMessage='Notification sound'
/>
</label>
<br/>
<FormattedMessage
id='user.settings.notifications.soundConfig'
defaultMessage='Please configure notification sounds in your browser settings'
/>
</div>
);
} else {
if (Utils.hasSoundOptions()) {
soundSection = (
<div>
<hr/>
@@ -109,11 +91,28 @@ export default class DesktopNotificationSettings extends React.Component {
<span>
<FormattedMessage
id='user.settings.notifications.sounds_info'
defaultMessage='Notification sounds are available on IE11, Edge, Safari, Chrome and Mattermost Desktop Apps.'
defaultMessage='Notification sounds are available on IE11, Safari, Chrome and Mattermost Desktop Apps.'
/>
</span>
</div>
);
} else {
soundSection = (
<div>
<hr/>
<label>
<FormattedMessage
id='user.settings.notifications.desktop.sound'
defaultMessage='Notification sound'
/>
</label>
<br/>
<FormattedMessage
id='user.settings.notifications.soundConfig'
defaultMessage='Please configure notification sounds in your browser settings'
/>
</div>
);
}
const durationRadio = [false, false, false, false];
@@ -304,26 +303,26 @@ export default class DesktopNotificationSettings extends React.Component {
buildMinimizedSetting() {
let describe = '';
if (this.props.activity === 'mention') {
if (UserAgent.isFirefox()) {
if (this.props.duration === '0') {
if (Utils.hasSoundOptions() && this.props.sound !== 'false') {
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.mentionsFirefoxForever'
defaultMessage='For mentions and direct messages, shown indefinitely'
id='user.settings.notifications.desktop.mentionsSoundForever'
defaultMessage='For mentions and direct messages, with sound, shown indefinitely'
/>
);
} else {
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.mentionsFirefoxTimed'
defaultMessage='For mentions and direct messages, shown for {seconds} seconds'
id='user.settings.notifications.desktop.mentionsSoundTimed'
defaultMessage='For mentions and direct messages, with sound, shown for {seconds} seconds'
values={{
seconds: this.props.duration
}}
/>
);
}
} else if (this.props.sound === 'false') {
} else if (Utils.hasSoundOptions() && this.props.sound === 'false') {
if (this.props.duration === '0') {
describe = (
<FormattedMessage
@@ -346,15 +345,15 @@ export default class DesktopNotificationSettings extends React.Component {
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.mentionsSoundForever'
defaultMessage='For mentions and direct messages, with sound, shown indefinitely'
id='user.settings.notifications.desktop.mentionsSoundHiddenForever'
defaultMessage='For mentions and direct messages, shown indefinitely'
/>
);
} else {
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.mentionsSoundTimed'
defaultMessage='For mentions and direct messages, with sound, shown for {seconds} seconds'
id='user.settings.notifications.desktop.mentionsSoundHiddenTimed'
defaultMessage='For mentions and direct messages, shown for {seconds} seconds'
values={{
seconds: this.props.duration
}}
@@ -370,26 +369,26 @@ export default class DesktopNotificationSettings extends React.Component {
/>
);
} else {
if (UserAgent.isFirefox()) { //eslint-disable-line no-lonely-if
if (this.props.duration === '0') {
if (Utils.hasSoundOptions() && this.props.sound !== 'false') { //eslint-disable-line no-lonely-if
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.allFirefoxForever'
defaultMessage='For all activity, shown indefinitely'
id='user.settings.notifications.desktop.allSoundForever'
defaultMessage='For all activity, with sound, shown indefinitely'
/>
);
} else {
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.allFirefoxTimed'
defaultMessage='For all activity, shown for {seconds} seconds'
id='user.settings.notifications.desktop.allSoundTimed'
defaultMessage='For all activity, with sound, shown for {seconds} seconds'
values={{
seconds: this.props.duration
}}
/>
);
}
} else if (this.props.sound === 'false') {
} else if (Utils.hasSoundOptions() && this.props.sound === 'false') {
if (this.props.duration === '0') {
describe = (
<FormattedMessage
@@ -412,15 +411,15 @@ export default class DesktopNotificationSettings extends React.Component {
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.allSoundForever'
defaultMessage='For all activity, with sound, shown indefinitely'
id='user.settings.notifications.desktop.allSoundHiddenForever'
defaultMessage='For all activity, shown indefinitely'
/>
);
} else {
describe = (
<FormattedMessage
id='user.settings.notifications.desktop.allSoundTimed'
defaultMessage='For all activity, with sound, shown for {seconds} seconds'
id='user.settings.notifications.desktop.allSoundHiddenTimed'
defaultMessage='For all activity, shown for {seconds} seconds'
values={{
seconds: this.props.duration
}}