fix notifications (?)

This commit is contained in:
hippoz 2020-11-20 22:10:42 +02:00
parent 98cb260ff5
commit 86ad93b318

View file

@ -240,11 +240,16 @@ const app = new Vue({
} }
if (messageObject.author.username !== this.loggedInUser.username && messageObject.category._id !== this.selection.category._id) { if (messageObject.author.username !== this.loggedInUser.username && messageObject.category._id !== this.selection.category._id) {
if (Notification.permission === 'granted') {
new Notification(`${messageObject.category.title}/${messageObject.author.username}`, messageObject.content);
}
this.okNotification(`${messageObject.category.title}/${messageObject.author.username}: ${messageObject.content}`); this.okNotification(`${messageObject.category.title}/${messageObject.author.username}: ${messageObject.content}`);
} }
if (messageObject.author.username !== this.loggedInUser.username) {
if (Notification.permission === 'granted') {
new Notification(`${messageObject.category.title}/${messageObject.author.username}`, {
body: messageObject.content
});
}
}
}, },
openChatForCategory: async function(categoryId) { openChatForCategory: async function(categoryId) {
this.gateway.subscribeToCategoryChat(categoryId); this.gateway.subscribeToCategoryChat(categoryId);