MM-59404 Stop automatically dismissing desktop notifications (#27627)

Этот коммит содержится в:
Harrison Healey
2024-07-15 12:53:17 -04:00
коммит произвёл GitHub
родитель fd0f1cf87e
Коммит 0227ac0fc1
2 изменённых файлов: 1 добавлений и 11 удалений

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

@@ -2046,7 +2046,6 @@ export const Constants = {
MENTION_RECENT_CHANNELS: 'mention.recent.channels',
MENTION_SPECIAL: 'mention.special',
MENTION_GROUPS: 'search.group',
DEFAULT_NOTIFICATION_DURATION: 5000,
STATUS_INTERVAL: 60000,
AUTOCOMPLETE_TIMEOUT: 100,
AUTOCOMPLETE_SPLIT_CHARACTERS: ['.', '-', '_'],

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

@@ -5,7 +5,6 @@ import type {ThunkActionFunc} from 'mattermost-redux/types/actions';
import icon50 from 'images/icon50x50.png';
import iconWS from 'images/icon_WS.png';
import Constants from 'utils/constants';
import * as UserAgent from 'utils/user_agent';
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
// 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
// the Constants.DEFAULT_NOTIFICATION_DURATION. Not all platforms support all features, and may
// resolves with a no-op callback. Not all platforms support all features, and may
// choose different semantics for the notifications.
export interface ShowNotificationParams {
@@ -98,13 +96,6 @@ export function showNotification(
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 {
status: 'success',
callback: () => {