diff --git a/src/main/main.ts b/src/main/main.ts index 576e72b3..353b1371 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -747,8 +747,8 @@ function initializeAfterAppReady() { // ipc communication event handlers // -function handleMentionNotification(event: IpcMainEvent, title: string, body: string, channel: {id: string}, teamId: string, silent: boolean, data: MentionData) { - displayMention(title, body, channel, teamId, silent, event.sender, data); +function handleMentionNotification(event: IpcMainEvent, title: string, body: string, channel: {id: string}, teamId: string, url: string, silent: boolean, data: MentionData) { + displayMention(title, body, channel, teamId, url, silent, event.sender, data); } function handleOpenAppMenu() { diff --git a/src/main/notifications/index.ts b/src/main/notifications/index.ts index 292f9fcd..405217ae 100644 --- a/src/main/notifications/index.ts +++ b/src/main/notifications/index.ts @@ -16,7 +16,7 @@ import {DownloadNotification} from './Download'; const currentNotifications = new Map(); -export function displayMention(title: string, body: string, channel: {id: string}, teamId: string, silent: boolean, webcontents: Electron.WebContents, data: MentionData) { +export function displayMention(title: string, body: string, channel: {id: string}, teamId: string, url: string, silent: boolean, webcontents: Electron.WebContents, data: MentionData) { if (!Notification.isSupported()) { log.error('notification not supported'); return; @@ -53,7 +53,7 @@ export function displayMention(title: string, body: string, channel: {id: string mention.on('click', () => { if (serverName) { windowManager.switchServer(serverName); - webcontents.send('notification-clicked', {channel, teamId}); + webcontents.send('notification-clicked', {channel, teamId, url}); } }); mention.show(); diff --git a/src/main/preload/mattermost.js b/src/main/preload/mattermost.js index cff7f19b..5a1050dd 100644 --- a/src/main/preload/mattermost.js +++ b/src/main/preload/mattermost.js @@ -110,8 +110,8 @@ window.addEventListener('message', ({origin, data = {}} = {}) => { // it will be captured by itself too break; case 'dispatch-notification': { - const {title, body, channel, teamId, silent, data: messageData} = message; - ipcRenderer.send(NOTIFY_MENTION, title, body, channel, teamId, silent, messageData); + const {title, body, channel, teamId, url, silent, data: messageData} = message; + ipcRenderer.send(NOTIFY_MENTION, title, body, channel, teamId, url, silent, messageData); break; } default: @@ -124,13 +124,14 @@ window.addEventListener('message', ({origin, data = {}} = {}) => { } }); -const handleNotificationClick = ({channel, teamId}) => { +const handleNotificationClick = ({channel, teamId, url}) => { window.postMessage( { type: 'notification-clicked', message: { channel, teamId, + url, }, }, window.location.origin,