MM-59404 Stop automatically dismissing desktop notifications (#27627)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fd0f1cf87e
Коммит
0227ac0fc1
@@ -2046,7 +2046,6 @@ export const Constants = {
|
|||||||
MENTION_RECENT_CHANNELS: 'mention.recent.channels',
|
MENTION_RECENT_CHANNELS: 'mention.recent.channels',
|
||||||
MENTION_SPECIAL: 'mention.special',
|
MENTION_SPECIAL: 'mention.special',
|
||||||
MENTION_GROUPS: 'search.group',
|
MENTION_GROUPS: 'search.group',
|
||||||
DEFAULT_NOTIFICATION_DURATION: 5000,
|
|
||||||
STATUS_INTERVAL: 60000,
|
STATUS_INTERVAL: 60000,
|
||||||
AUTOCOMPLETE_TIMEOUT: 100,
|
AUTOCOMPLETE_TIMEOUT: 100,
|
||||||
AUTOCOMPLETE_SPLIT_CHARACTERS: ['.', '-', '_'],
|
AUTOCOMPLETE_SPLIT_CHARACTERS: ['.', '-', '_'],
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import type {ThunkActionFunc} from 'mattermost-redux/types/actions';
|
|||||||
|
|
||||||
import icon50 from 'images/icon50x50.png';
|
import icon50 from 'images/icon50x50.png';
|
||||||
import iconWS from 'images/icon_WS.png';
|
import iconWS from 'images/icon_WS.png';
|
||||||
import Constants from 'utils/constants';
|
|
||||||
import * as UserAgent from 'utils/user_agent';
|
import * as UserAgent from 'utils/user_agent';
|
||||||
|
|
||||||
export type NotificationResult = {
|
export type NotificationResult = {
|
||||||
@@ -20,8 +19,7 @@ let requestedNotificationPermission = Boolean('Notification' in window && Notifi
|
|||||||
//
|
//
|
||||||
// If successful in showing a notification, it resolves with a callback to manually close the
|
// If successful in showing a notification, it resolves with a callback to manually close the
|
||||||
// notification. If no error occurred but the user did not grant permission to show notifications, it
|
// notification. If no error occurred but the user did not grant permission to show notifications, it
|
||||||
// resolves with a no-op callback. Notifications that do not require interaction will be closed automatically after
|
// resolves with a no-op callback. Not all platforms support all features, and may
|
||||||
// the Constants.DEFAULT_NOTIFICATION_DURATION. Not all platforms support all features, and may
|
|
||||||
// choose different semantics for the notifications.
|
// choose different semantics for the notifications.
|
||||||
|
|
||||||
export interface ShowNotificationParams {
|
export interface ShowNotificationParams {
|
||||||
@@ -98,13 +96,6 @@ export function showNotification(
|
|||||||
throw new Error('Notification failed to show.');
|
throw new Error('Notification failed to show.');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mac desktop app notification dismissal is handled by the OS
|
|
||||||
if (!requireInteraction && !UserAgent.isMacApp()) {
|
|
||||||
setTimeout(() => {
|
|
||||||
notification.close();
|
|
||||||
}, Constants.DEFAULT_NOTIFICATION_DURATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: 'success',
|
status: 'success',
|
||||||
callback: () => {
|
callback: () => {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user