diff --git a/app/soapbox/actions/streaming.ts b/app/soapbox/actions/streaming.ts index c77daa6ac..dcb190f25 100644 --- a/app/soapbox/actions/streaming.ts +++ b/app/soapbox/actions/streaming.ts @@ -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; } }, }; diff --git a/app/soapbox/components/helmet.tsx b/app/soapbox/components/helmet.tsx index 81383ad08..cd13dd30a 100644 --- a/app/soapbox/components/helmet.tsx +++ b/app/soapbox/components/helmet.tsx @@ -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; };