Skip to content
Snippets Groups Projects
Commit 969cfe8a authored by syuilo's avatar syuilo
Browse files

[Client:Desktop] Show a notification when received a new message

parent c574b130
No related branches found
No related tags found
No related merge requests found
......@@ -74,4 +74,18 @@ function registerNotifications(stream) {
});
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);
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment