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
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
ea095d6206
Коммит
3174c9a07d
@@ -5,7 +5,6 @@ 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 * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import * as UserAgent from 'utils/user_agent.jsx';
|
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
@@ -45,24 +44,7 @@ export default class DesktopNotificationSettings extends React.Component {
|
|||||||
soundRadio[0] = true;
|
soundRadio[0] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserAgent.isFirefox()) {
|
if (Utils.hasSoundOptions()) {
|
||||||
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 {
|
|
||||||
soundSection = (
|
soundSection = (
|
||||||
<div>
|
<div>
|
||||||
<hr/>
|
<hr/>
|
||||||
@@ -109,11 +91,28 @@ export default class DesktopNotificationSettings extends React.Component {
|
|||||||
<span>
|
<span>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.sounds_info'
|
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>
|
</span>
|
||||||
</div>
|
</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];
|
const durationRadio = [false, false, false, false];
|
||||||
@@ -304,26 +303,26 @@ export default class DesktopNotificationSettings extends React.Component {
|
|||||||
buildMinimizedSetting() {
|
buildMinimizedSetting() {
|
||||||
let describe = '';
|
let describe = '';
|
||||||
if (this.props.activity === 'mention') {
|
if (this.props.activity === 'mention') {
|
||||||
if (UserAgent.isFirefox()) {
|
if (Utils.hasSoundOptions() && this.props.sound !== 'false') {
|
||||||
if (this.props.duration === '0') {
|
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.mentionsFirefoxForever'
|
id='user.settings.notifications.desktop.mentionsSoundForever'
|
||||||
defaultMessage='For mentions and direct messages, shown indefinitely'
|
defaultMessage='For mentions and direct messages, with sound, shown indefinitely'
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.mentionsFirefoxTimed'
|
id='user.settings.notifications.desktop.mentionsSoundTimed'
|
||||||
defaultMessage='For mentions and direct messages, shown for {seconds} seconds'
|
defaultMessage='For mentions and direct messages, with sound, shown for {seconds} seconds'
|
||||||
values={{
|
values={{
|
||||||
seconds: this.props.duration
|
seconds: this.props.duration
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (this.props.sound === 'false') {
|
} else if (Utils.hasSoundOptions() && this.props.sound === 'false') {
|
||||||
if (this.props.duration === '0') {
|
if (this.props.duration === '0') {
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
@@ -346,15 +345,15 @@ export default class DesktopNotificationSettings extends React.Component {
|
|||||||
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
|
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.mentionsSoundForever'
|
id='user.settings.notifications.desktop.mentionsSoundHiddenForever'
|
||||||
defaultMessage='For mentions and direct messages, with sound, shown indefinitely'
|
defaultMessage='For mentions and direct messages, shown indefinitely'
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.mentionsSoundTimed'
|
id='user.settings.notifications.desktop.mentionsSoundHiddenTimed'
|
||||||
defaultMessage='For mentions and direct messages, with sound, shown for {seconds} seconds'
|
defaultMessage='For mentions and direct messages, shown for {seconds} seconds'
|
||||||
values={{
|
values={{
|
||||||
seconds: this.props.duration
|
seconds: this.props.duration
|
||||||
}}
|
}}
|
||||||
@@ -370,26 +369,26 @@ export default class DesktopNotificationSettings extends React.Component {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (UserAgent.isFirefox()) { //eslint-disable-line no-lonely-if
|
if (Utils.hasSoundOptions() && this.props.sound !== 'false') { //eslint-disable-line no-lonely-if
|
||||||
if (this.props.duration === '0') {
|
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.allFirefoxForever'
|
id='user.settings.notifications.desktop.allSoundForever'
|
||||||
defaultMessage='For all activity, shown indefinitely'
|
defaultMessage='For all activity, with sound, shown indefinitely'
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.allFirefoxTimed'
|
id='user.settings.notifications.desktop.allSoundTimed'
|
||||||
defaultMessage='For all activity, shown for {seconds} seconds'
|
defaultMessage='For all activity, with sound, shown for {seconds} seconds'
|
||||||
values={{
|
values={{
|
||||||
seconds: this.props.duration
|
seconds: this.props.duration
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (this.props.sound === 'false') {
|
} else if (Utils.hasSoundOptions() && this.props.sound === 'false') {
|
||||||
if (this.props.duration === '0') {
|
if (this.props.duration === '0') {
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
@@ -412,15 +411,15 @@ export default class DesktopNotificationSettings extends React.Component {
|
|||||||
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
|
if (this.props.duration === '0') { //eslint-disable-line no-lonely-if
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.allSoundForever'
|
id='user.settings.notifications.desktop.allSoundHiddenForever'
|
||||||
defaultMessage='For all activity, with sound, shown indefinitely'
|
defaultMessage='For all activity, shown indefinitely'
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
describe = (
|
describe = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.notifications.desktop.allSoundTimed'
|
id='user.settings.notifications.desktop.allSoundHiddenTimed'
|
||||||
defaultMessage='For all activity, with sound, shown for {seconds} seconds'
|
defaultMessage='For all activity, shown for {seconds} seconds'
|
||||||
values={{
|
values={{
|
||||||
seconds: this.props.duration
|
seconds: this.props.duration
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -2411,16 +2411,16 @@
|
|||||||
"user.settings.notifications.commentsNever": "Do not trigger notifications on messages in reply threads unless I'm mentioned",
|
"user.settings.notifications.commentsNever": "Do not trigger notifications on messages in reply threads unless I'm mentioned",
|
||||||
"user.settings.notifications.commentsRoot": "Trigger notifications on messages in threads that I start",
|
"user.settings.notifications.commentsRoot": "Trigger notifications on messages in threads that I start",
|
||||||
"user.settings.notifications.desktop": "Send desktop notifications",
|
"user.settings.notifications.desktop": "Send desktop notifications",
|
||||||
"user.settings.notifications.desktop.allFirefoxForever": "For all activity, shown indefinitely",
|
"user.settings.notifications.desktop.allSoundHiddenForever": "For all activity, shown indefinitely",
|
||||||
"user.settings.notifications.desktop.allFirefoxTimed": "For all activity, shown for {seconds} seconds",
|
"user.settings.notifications.desktop.allSoundHiddenTimed": "For all activity, shown for {seconds} seconds",
|
||||||
"user.settings.notifications.desktop.allNoSoundForever": "For all activity, without sound, shown indefinitely",
|
"user.settings.notifications.desktop.allNoSoundForever": "For all activity, without sound, shown indefinitely",
|
||||||
"user.settings.notifications.desktop.allNoSoundTimed": "For all activity, without sound, shown for {seconds} seconds",
|
"user.settings.notifications.desktop.allNoSoundTimed": "For all activity, without sound, shown for {seconds} seconds",
|
||||||
"user.settings.notifications.desktop.allSoundForever": "For all activity, with sound, shown indefinitely",
|
"user.settings.notifications.desktop.allSoundForever": "For all activity, with sound, shown indefinitely",
|
||||||
"user.settings.notifications.desktop.allSoundTimed": "For all activity, with sound, shown for {seconds} seconds",
|
"user.settings.notifications.desktop.allSoundTimed": "For all activity, with sound, shown for {seconds} seconds",
|
||||||
"user.settings.notifications.desktop.duration": "Notification duration",
|
"user.settings.notifications.desktop.duration": "Notification duration",
|
||||||
"user.settings.notifications.desktop.durationInfo": "Sets how long desktop notifications will remain on screen when using Firefox or Chrome. Desktop notifications in Edge and Safari can only stay on screen for a maximum of 5 seconds.",
|
"user.settings.notifications.desktop.durationInfo": "Sets how long desktop notifications will remain on screen when using Firefox or Chrome. Desktop notifications in Edge and Safari can only stay on screen for a maximum of 5 seconds.",
|
||||||
"user.settings.notifications.desktop.mentionsFirefoxForever": "For mentions and direct messages, shown indefinitely",
|
"user.settings.notifications.desktop.mentionsSoundHiddenForever": "For mentions and direct messages, shown indefinitely",
|
||||||
"user.settings.notifications.desktop.mentionsFirefoxTimed": "For mentions and direct messages, shown for {seconds} seconds",
|
"user.settings.notifications.desktop.mentionsSoundHiddenTimed": "For mentions and direct messages, shown for {seconds} seconds",
|
||||||
"user.settings.notifications.desktop.mentionsNoSoundForever": "For mentions and direct messages, without sound, shown indefinitely",
|
"user.settings.notifications.desktop.mentionsNoSoundForever": "For mentions and direct messages, without sound, shown indefinitely",
|
||||||
"user.settings.notifications.desktop.mentionsNoSoundTimed": "For mentions and direct messages, without sound, shown for {seconds} seconds",
|
"user.settings.notifications.desktop.mentionsNoSoundTimed": "For mentions and direct messages, without sound, shown for {seconds} seconds",
|
||||||
"user.settings.notifications.desktop.mentionsSoundForever": "For mentions and direct messages, with sound, shown indefinitely",
|
"user.settings.notifications.desktop.mentionsSoundForever": "For mentions and direct messages, with sound, shown indefinitely",
|
||||||
@@ -2454,7 +2454,7 @@
|
|||||||
"user.settings.notifications.sensitiveUsername": "Your non-case sensitive username \"{username}\"",
|
"user.settings.notifications.sensitiveUsername": "Your non-case sensitive username \"{username}\"",
|
||||||
"user.settings.notifications.sensitiveWords": "Other non-case sensitive words, separated by commas:",
|
"user.settings.notifications.sensitiveWords": "Other non-case sensitive words, separated by commas:",
|
||||||
"user.settings.notifications.soundConfig": "Please configure notification sounds in your browser settings",
|
"user.settings.notifications.soundConfig": "Please configure notification sounds in your browser settings",
|
||||||
"user.settings.notifications.sounds_info": "Notification sounds are available on IE11, Edge, Safari, Chrome and Mattermost Desktop Apps.",
|
"user.settings.notifications.sounds_info": "Notification sounds are available on IE11, Safari, Chrome and Mattermost Desktop Apps.",
|
||||||
"user.settings.notifications.teamWide": "Team-wide mentions \"@all\"",
|
"user.settings.notifications.teamWide": "Team-wide mentions \"@all\"",
|
||||||
"user.settings.notifications.title": "Notification Settings",
|
"user.settings.notifications.title": "Notification Settings",
|
||||||
"user.settings.notifications.wordsTrigger": "Words that trigger mentions",
|
"user.settings.notifications.wordsTrigger": "Words that trigger mentions",
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ export function notifyMe(title, body, channel, teamId, duration, silent) {
|
|||||||
var canDing = true;
|
var canDing = true;
|
||||||
|
|
||||||
export function ding() {
|
export function ding() {
|
||||||
if (!UserAgent.isFirefox() && canDing) {
|
if (hasSoundOptions() && canDing) {
|
||||||
var audio = new Audio(bing);
|
var audio = new Audio(bing);
|
||||||
audio.play();
|
audio.play();
|
||||||
canDing = false;
|
canDing = false;
|
||||||
@@ -165,6 +165,10 @@ export function ding() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasSoundOptions() {
|
||||||
|
return (!(UserAgent.isFirefox()) && !(UserAgent.isEdge()));
|
||||||
|
}
|
||||||
|
|
||||||
export function getDateForUnixTicks(ticks) {
|
export function getDateForUnixTicks(ticks) {
|
||||||
return new Date(ticks);
|
return new Date(ticks);
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user