diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index fcab36ac399..04f472d6455 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -141,14 +141,12 @@ export default class ElectronPlatform extends VectorBasePlatform { } // Notifications in Electron use the HTML5 notification API - const notification = new global.Notification( - title, - { - body: msg, - icon: avatarUrl, - silent: true, // we play our own sounds - }, - ); + const notifBody = { + body: msg, + silent: true, // we play our own sounds + }; + if (avatarUrl) notifBody['icon'] = avatarUrl; + const notification = new global.Notification(title, notifBody); notification.onclick = () => { dis.dispatch({ diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js index d850dd6ddd5..984aa8da3ad 100644 --- a/src/vector/platform/WebPlatform.js +++ b/src/vector/platform/WebPlatform.js @@ -76,15 +76,13 @@ export default class WebPlatform extends VectorBasePlatform { } displayNotification(title: string, msg: string, avatarUrl: string, room: Object) { - const notification = new global.Notification( - title, - { - body: msg, - icon: avatarUrl, - tag: "vector", - silent: true, // we play our own sounds - }, - ); + const notifBody = { + body: msg, + tag: "vector", + silent: true, // we play our own sounds + }; + if (avatarUrl) notifBody['icon'] = avatarUrl; + const notification = new global.Notification(title, notifBody); notification.onclick = function() { dis.dispatch({