From 7bb19f5b9b8a0ea9fcbf944b4e3fbbb3adb4a928 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 17 Mar 2018 17:53:35 +0900 Subject: [PATCH] #1252 --- src/web/app/common/scripts/compose-notification.ts | 7 +++++++ src/web/app/desktop/script.ts | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/web/app/common/scripts/compose-notification.ts b/src/web/app/common/scripts/compose-notification.ts index d0e0c2098d..e1dbd3bc13 100644 --- a/src/web/app/common/scripts/compose-notification.ts +++ b/src/web/app/common/scripts/compose-notification.ts @@ -54,6 +54,13 @@ export default function(type, data): Notification { icon: data.user.avatar_url + '?thumbnail&size=64' }; + case 'othello_invited': + return { + title: '対局への招待があります', + body: `${data.parent.name}さんから`, + icon: data.parent.avatar_url + '?thumbnail&size=64' + }; + default: return null; } diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index 25a60d7ecc..2362613cdc 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -150,5 +150,13 @@ function registerNotifications(stream: HomeStreamManager) { }; setTimeout(n.close.bind(n), 7000); }); + + connection.on('othello_invited', matching => { + const _n = composeNotification('othello_invited', matching); + const n = new Notification(_n.title, { + body: _n.body, + icon: _n.icon + }); + }); } }