Convert notification requests actions and reducers to Typescript (#31866)
This commit is contained in:
1 parent
d5cf27e667
commit
c0eda832f3
12 files changed
+585
-492
No files matched your search
@@ -2,7 +2,7 @@ import { createAction } from '@reduxjs/toolkit';
|
||||
|
||||
import {
|
||||
apiClearNotifications,
|
||||
apiFetchNotifications,
|
||||
apiFetchNotificationGroups,
|
||||
} from 'mastodon/api/notifications';
|
||||
import type { ApiAccountJSON } from 'mastodon/api_types/accounts';
|
||||
import type {
|
||||
@@ -71,7 +71,7 @@ function dispatchAssociatedRecords(
|
||||
export const fetchNotifications = createDataLoadingThunk(
|
||||
'notificationGroups/fetch',
|
||||
async (_params, { getState }) =>
|
||||
apiFetchNotifications({ exclude_types: getExcludedTypes(getState()) }),
|
||||
apiFetchNotificationGroups({ exclude_types: getExcludedTypes(getState()) }),
|
||||
({ notifications, accounts, statuses }, { dispatch }) => {
|
||||
dispatch(importFetchedAccounts(accounts));
|
||||
dispatch(importFetchedStatuses(statuses));
|
||||
@@ -92,7 +92,7 @@ export const fetchNotifications = createDataLoadingThunk(
|
||||
export const fetchNotificationsGap = createDataLoadingThunk(
|
||||
'notificationGroups/fetchGap',
|
||||
async (params: { gap: NotificationGap }, { getState }) =>
|
||||
apiFetchNotifications({
|
||||
apiFetchNotificationGroups({
|
||||
max_id: params.gap.maxId,
|
||||
exclude_types: getExcludedTypes(getState()),
|
||||
}),
|
||||
@@ -108,7 +108,7 @@ export const fetchNotificationsGap = createDataLoadingThunk(
|
||||
export const pollRecentNotifications = createDataLoadingThunk(
|
||||
'notificationGroups/pollRecentNotifications',
|
||||
async (_params, { getState }) => {
|
||||
return apiFetchNotifications({
|
||||
return apiFetchNotificationGroups({
|
||||
max_id: undefined,
|
||||
exclude_types: getExcludedTypes(getState()),
|
||||
// In slow mode, we don't want to include notifications that duplicate the already-displayed ones
|
||||
|
||||
Reference in new issue
Block a user