Add more "instance" + saveStatus for new notifications

This commit is contained in:
Lim Chee Aun 2023-02-25 14:20:26 +08:00
parent 2afa84c2fd
commit 7b66b832d5
3 changed files with 8 additions and 4 deletions

View file

@ -175,7 +175,7 @@ function App() {
const notificationStream = useRef(); const notificationStream = useRef();
useEffect(() => { useEffect(() => {
if (isLoggedIn && visible) { if (isLoggedIn && visible) {
const { masto } = api(); const { masto, instance } = api();
(async () => { (async () => {
// 1. Get the latest notification // 1. Get the latest notification
if (states.notificationsLast) { if (states.notificationsLast) {
@ -200,6 +200,11 @@ function App() {
notificationStream.current.on('notification', (notification) => { notificationStream.current.on('notification', (notification) => {
console.log('🔔🔔 Notification', notification); console.log('🔔🔔 Notification', notification);
if (notification.status) {
saveStatus(notification.status, instance, {
skipThreading: true,
});
}
states.notificationsShowNew = true; states.notificationsShowNew = true;
}); });

View file

@ -772,7 +772,7 @@ function Compose({
editStatus.id, editStatus.id,
params, params,
); );
saveStatus(newStatus, { saveStatus(newStatus, instance, {
skipThreading: true, skipThreading: true,
}); });
} else { } else {

View file

@ -77,9 +77,8 @@ function Notifications() {
if (notifications?.length) { if (notifications?.length) {
notifications.forEach((notification) => { notifications.forEach((notification) => {
saveStatus(notification.status, { saveStatus(notification.status, instance, {
skipThreading: true, skipThreading: true,
override: false,
}); });
}); });