Merge branch 'stream-markers' into 'develop'

streaming: Handle marker updates

See merge request soapbox-pub/soapbox-fe!1697
environments/review-develop-3zknud/deployments/686
marcin mikołajczak 2022-08-02 08:03:56 +00:00
commit ba45dba216
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;
};