Stream marker updates

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
merge-requests/1697/head
marcin mikołajczak 2022-08-01 18:31:49 +02:00
rodzic 30ec3dbd9f
commit 560f4592e7
2 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -11,6 +11,7 @@ import {
} from './announcements';
import { updateConversations } from './conversations';
import { fetchFilters } from './filters';
import { MARKER_FETCH_SUCCESS } from './markers';
import { updateNotificationsQueue, expandNotifications } from './notifications';
import { updateStatus } from './statuses';
import {
@ -115,6 +116,9 @@ const connectTimelineStream = (
case 'announcement.delete':
dispatch(deleteAnnouncement(data.payload));
break;
case 'marker':
dispatch({ type: MARKER_FETCH_SUCCESS, marker: JSON.parse(data.payload) });
break;
}
},
};

Wyświetl plik

@ -2,15 +2,16 @@ import * as React from 'react';
import { Helmet as ReactHelmet } from 'react-helmet';
import { useAppSelector, useSettings } from 'soapbox/hooks';
import { RootState } from 'soapbox/store';
import FaviconService from 'soapbox/utils/favicon_service';
FaviconService.initFaviconService();
const getNotifTotals = (state: any): number => {
const notifications = state.getIn(['notifications', 'unread'], 0);
const chats = state.getIn(['chats', 'items']).reduce((acc: any, curr: any) => acc + Math.min(curr.get('unread', 0), 1), 0);
const reports = state.getIn(['admin', 'openReports']).count();
const approvals = state.getIn(['admin', 'awaitingApproval']).count();
const getNotifTotals = (state: RootState): number => {
const notifications = state.notifications.unread || 0;
const chats = state.chats.items.reduce((acc: any, curr: any) => acc + Math.min(curr.get('unread', 0), 1), 0);
const reports = state.admin.openReports.count();
const approvals = state.admin.awaitingApproval.count();
return notifications + chats + reports + approvals;
};