mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 02:33:09 +02:00
[Client:Desktop] Show a notification when received a new message
This commit is contained in:
parent
c574b13093
commit
969cfe8a08
1 changed files with 14 additions and 0 deletions
|
@ -74,4 +74,18 @@ function registerNotifications(stream) {
|
||||||
});
|
});
|
||||||
setTimeout(n.close.bind(n), 6000);
|
setTimeout(n.close.bind(n), 6000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
stream.on('unread_messaging_message', message => {
|
||||||
|
const n = new Notification(`${message.user.name}さんからメッセージ:`, {
|
||||||
|
body: message.text, // TODO: getMessagingMessageSummary(message),
|
||||||
|
icon: message.user.avatar_url + '?thumbnail&size=64'
|
||||||
|
});
|
||||||
|
n.onclick = () => {
|
||||||
|
n.close();
|
||||||
|
riot.mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), {
|
||||||
|
user: message.user
|
||||||
|
});
|
||||||
|
};
|
||||||
|
setTimeout(n.close.bind(n), 7000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue