MM-36234: CRT, handle click on notification (#1699)

Clicking on a notification that regards a reply to a thread,
and when the user has CRT set to ON, should open the corresponding thread.

This is done by passing the URL to push to the browser along side the
notification.

Webapp: If a `url` is passed it will be used, otherwise the URL pushed to
history would be the corresponding channel (as is right now).
This commit is contained in:
Kyriakos Z
2021-08-19 17:36:07 +03:00
committed by GitHub
parent 40dfbdb884
commit 9ce5cb759d
3 changed files with 8 additions and 7 deletions

View File

@@ -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,