From 7b66b832d56164af72958db7ca4aa0dc24c77944 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sat, 25 Feb 2023 14:20:26 +0800 Subject: [PATCH] Add more "instance" + saveStatus for new notifications --- src/app.jsx | 7 ++++++- src/components/compose.jsx | 2 +- src/pages/notifications.jsx | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app.jsx b/src/app.jsx index 113b74ae..95dc9eef 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -175,7 +175,7 @@ function App() { const notificationStream = useRef(); useEffect(() => { if (isLoggedIn && visible) { - const { masto } = api(); + const { masto, instance } = api(); (async () => { // 1. Get the latest notification if (states.notificationsLast) { @@ -200,6 +200,11 @@ function App() { notificationStream.current.on('notification', (notification) => { console.log('🔔🔔 Notification', notification); + if (notification.status) { + saveStatus(notification.status, instance, { + skipThreading: true, + }); + } states.notificationsShowNew = true; }); diff --git a/src/components/compose.jsx b/src/components/compose.jsx index 848e8c8f..9fdd23bd 100644 --- a/src/components/compose.jsx +++ b/src/components/compose.jsx @@ -772,7 +772,7 @@ function Compose({ editStatus.id, params, ); - saveStatus(newStatus, { + saveStatus(newStatus, instance, { skipThreading: true, }); } else { diff --git a/src/pages/notifications.jsx b/src/pages/notifications.jsx index 059fa421..0d0e0473 100644 --- a/src/pages/notifications.jsx +++ b/src/pages/notifications.jsx @@ -77,9 +77,8 @@ function Notifications() { if (notifications?.length) { notifications.forEach((notification) => { - saveStatus(notification.status, { + saveStatus(notification.status, instance, { skipThreading: true, - override: false, }); });