sforkowany z mirror/soapbox
Stream marker updates
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>react-query-api
rodzic
30ec3dbd9f
commit
560f4592e7
|
@ -11,6 +11,7 @@ import {
|
||||||
} from './announcements';
|
} from './announcements';
|
||||||
import { updateConversations } from './conversations';
|
import { updateConversations } from './conversations';
|
||||||
import { fetchFilters } from './filters';
|
import { fetchFilters } from './filters';
|
||||||
|
import { MARKER_FETCH_SUCCESS } from './markers';
|
||||||
import { updateNotificationsQueue, expandNotifications } from './notifications';
|
import { updateNotificationsQueue, expandNotifications } from './notifications';
|
||||||
import { updateStatus } from './statuses';
|
import { updateStatus } from './statuses';
|
||||||
import {
|
import {
|
||||||
|
@ -115,6 +116,9 @@ const connectTimelineStream = (
|
||||||
case 'announcement.delete':
|
case 'announcement.delete':
|
||||||
dispatch(deleteAnnouncement(data.payload));
|
dispatch(deleteAnnouncement(data.payload));
|
||||||
break;
|
break;
|
||||||
|
case 'marker':
|
||||||
|
dispatch({ type: MARKER_FETCH_SUCCESS, marker: JSON.parse(data.payload) });
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,15 +2,16 @@ import * as React from 'react';
|
||||||
import { Helmet as ReactHelmet } from 'react-helmet';
|
import { Helmet as ReactHelmet } from 'react-helmet';
|
||||||
|
|
||||||
import { useAppSelector, useSettings } from 'soapbox/hooks';
|
import { useAppSelector, useSettings } from 'soapbox/hooks';
|
||||||
|
import { RootState } from 'soapbox/store';
|
||||||
import FaviconService from 'soapbox/utils/favicon_service';
|
import FaviconService from 'soapbox/utils/favicon_service';
|
||||||
|
|
||||||
FaviconService.initFaviconService();
|
FaviconService.initFaviconService();
|
||||||
|
|
||||||
const getNotifTotals = (state: any): number => {
|
const getNotifTotals = (state: RootState): number => {
|
||||||
const notifications = state.getIn(['notifications', 'unread'], 0);
|
const notifications = state.notifications.unread || 0;
|
||||||
const chats = state.getIn(['chats', 'items']).reduce((acc: any, curr: any) => acc + Math.min(curr.get('unread', 0), 1), 0);
|
const chats = state.chats.items.reduce((acc: any, curr: any) => acc + Math.min(curr.get('unread', 0), 1), 0);
|
||||||
const reports = state.getIn(['admin', 'openReports']).count();
|
const reports = state.admin.openReports.count();
|
||||||
const approvals = state.getIn(['admin', 'awaitingApproval']).count();
|
const approvals = state.admin.awaitingApproval.count();
|
||||||
return notifications + chats + reports + approvals;
|
return notifications + chats + reports + approvals;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue