From 0f4a3ec7a2f688437075c789d495d6a69516d916 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 10 Apr 2022 18:43:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dnotify=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/plugins/com.msgbyte.notify/src/notify.ts | 25 ++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/web/plugins/com.msgbyte.notify/src/notify.ts b/web/plugins/com.msgbyte.notify/src/notify.ts index 541f4d31..fa3f02ce 100644 --- a/web/plugins/com.msgbyte.notify/src/notify.ts +++ b/web/plugins/com.msgbyte.notify/src/notify.ts @@ -18,19 +18,20 @@ export function initNotify() { // TODO: 需要增加所在群组 if (Notification.permission === 'granted') { - Promise.all([getCachedUserInfo(currentUserId)]).then(([userInfo]) => { - console.log(userInfo, message); - const nickname = userInfo?.nickname ?? ''; - const icon = userInfo?.avatar ?? undefined; - const content = message.content; + Promise.all([getCachedUserInfo(message.author)]).then( + ([userInfo]) => { + const nickname = userInfo?.nickname ?? ''; + const icon = userInfo?.avatar ?? undefined; + const content = message.content; - new Notification(`来自 ${nickname}`, { - body: content, - icon, - tag: 'tailchat-message', - renotify: true, - }); - }); + new Notification(`来自 ${nickname}`, { + body: content, + icon, + tag: 'tailchat-message', + renotify: true, + }); + } + ); } } },