Skip to content

Commit

Permalink
Don't try and render null avatars in desktop notifications
Browse files Browse the repository at this point in the history
as much fun as http://localhost:8080/null is to see
  • Loading branch information
turt2live committed May 31, 2019
1 parent 98f2d86 commit c5461b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
14 changes: 6 additions & 8 deletions src/vector/platform/ElectronPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
16 changes: 7 additions & 9 deletions src/vector/platform/WebPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit c5461b4

Please sign in to comment.