From 4e645905641eee7b4d89edb181a76baae8ddbaeb Mon Sep 17 00:00:00 2001 From: Christopher Poile Date: Fri, 23 Jun 2023 14:29:59 -0400 Subject: [PATCH] MM-52857 - Expose webapp and desktop notifications to plugins (#23779) * prevent media keys from controlling calls ring sounds * stop ring on pause * expose notifyMe as sendDesktopNotificationToMe * Revert "stop ring on pause" This reverts commit 83d62ad02db9acc7684a1f352d798ffc74e665d8. * Revert "prevent media keys from controlling calls ring sounds" This reverts commit 6d4ff63936674034adda84fc258bcafe71734cab. * move into WebappUtils --------- Co-authored-by: Mattermost Build --- webapp/channels/src/actions/notification_actions.jsx | 2 +- webapp/channels/src/plugins/export.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/channels/src/actions/notification_actions.jsx b/webapp/channels/src/actions/notification_actions.jsx index d63960c818..f0d03ce38b 100644 --- a/webapp/channels/src/actions/notification_actions.jsx +++ b/webapp/channels/src/actions/notification_actions.jsx @@ -210,7 +210,7 @@ export function sendDesktopNotification(post, msgProps) { }; } -const notifyMe = (title, body, channel, teamId, silent, soundName, url) => (dispatch) => { +export const notifyMe = (title, body, channel, teamId, silent, soundName, url) => (dispatch) => { // handle notifications in desktop app if (isDesktopApp()) { const msg = { diff --git a/webapp/channels/src/plugins/export.js b/webapp/channels/src/plugins/export.js index 53bf14a02a..4679a50626 100644 --- a/webapp/channels/src/plugins/export.js +++ b/webapp/channels/src/plugins/export.js @@ -2,6 +2,7 @@ // See LICENSE.txt for license information. import {closeRightHandSide, selectPostById} from 'actions/views/rhs'; +import {notifyMe} from 'actions/notification_actions'; import {getSelectedPostId, getIsRhsOpen} from 'selectors/rhs'; import BotTag from 'components/widgets/tag/bot_tag'; @@ -50,6 +51,7 @@ window.useNotifyAdmin = useNotifyAdmin; window.WebappUtils = { modals: {openModal, ModalIdentifiers}, notificationSounds: {ring: NotificationSounds.ring, stopRing: NotificationSounds.stopRing}, + sendDesktopNotificationToMe: notifyMe, }; Object.defineProperty(window.WebappUtils, 'browserHistory', { get: () => getHistory(),