Merge commit 'ead13d4826a7ba1699d6bb310e58642b15687671' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2026-06-07 14:29:57 +02:00
commit c2e6cbb12b
166 files changed
+1123 -500

No files matched your search

@@ -4,6 +4,7 @@ import { importAccounts } from './accounts';
import { importCustomEmoji } from './emoji';
import { normalizeStatus } from './normalizer';
import { importPolls } from './polls';
import { fetchAccountsForCollectionPreview } from '@/mastodon/reducers/slices/collections';
export const STATUS_IMPORT = 'STATUS_IMPORT';
export const STATUSES_IMPORT = 'STATUSES_IMPORT';
@@ -61,6 +62,7 @@ export function importFetchedStatuses(statuses, options = {}) {
const normalStatuses = [];
const polls = [];
const filters = [];
const collections = [];
function processStatus(status) {
pushUnique(normalStatuses, normalizeStatus(status, getState().getIn(['statuses', status.id]), options));
@@ -82,6 +84,10 @@ export function importFetchedStatuses(statuses, options = {}) {
pushUnique(polls, createPollFromServerJSON(status.poll, getState().polls[status.poll.id]));
}
if (status.tagged_collections.length) {
status.tagged_collections.forEach(collection => pushUnique(collections, collection));
}
if (status.card) {
status.card.authors.forEach(author => author.account && pushUnique(accounts, author.account));
}
@@ -97,5 +103,6 @@ export function importFetchedStatuses(statuses, options = {}) {
dispatch(importFetchedAccounts(accounts));
dispatch(importStatuses(normalStatuses));
dispatch(importFilters(filters));
fetchAccountsForCollectionPreview(collections, dispatch);
};
}
@@ -5,6 +5,7 @@ import {
apiFetchNotificationGroups,
} from 'mastodon/api/notifications';
import type { ApiAccountJSON } from 'mastodon/api_types/accounts';
import type { ApiCollectionJSON } from 'mastodon/api_types/collections';
import type {
ApiNotificationGroupJSON,
ApiNotificationJSON,
@@ -26,6 +27,8 @@ import {
createDataLoadingThunk,
} from 'mastodon/store/typed_functions';
import { fetchAccountsForCollectionPreview } from '../reducers/slices/collections';
import { importFetchedAccounts, importFetchedStatuses } from './importer';
import { NOTIFICATIONS_FILTER_SET } from './notifications';
import { saveSettings } from './settings';
@@ -70,6 +73,7 @@ function dispatchAssociatedRecords(
) {
const fetchedAccounts: ApiAccountJSON[] = [];
const fetchedStatuses: ApiStatusJSON[] = [];
const collections: ApiCollectionJSON[] = [];
notifications.forEach((notification) => {
if (notification.type === 'admin.report') {
@@ -83,6 +87,10 @@ function dispatchAssociatedRecords(
if ('status' in notification && notification.status) {
fetchedStatuses.push(notification.status);
}
if ('collection' in notification && notification.collection) {
collections.push(notification.collection);
}
});
if (fetchedAccounts.length > 0)
@@ -90,6 +98,9 @@ function dispatchAssociatedRecords(
if (fetchedStatuses.length > 0)
dispatch(importFetchedStatuses(fetchedStatuses));
if (collections.length > 0)
void fetchAccountsForCollectionPreview(collections, dispatch);
}
function selectNotificationGroupedTypes(state: RootState) {
+17 -2
View File
@@ -12,6 +12,11 @@ import {
createAppAsyncThunk,
} from 'mastodon/store/typed_functions';
import {
fetchAccountsForCollectionPreview,
importFetchedCollections,
} from '../reducers/slices/collections';
import { fetchRelationships } from './accounts';
import { importFetchedAccounts, importFetchedStatuses } from './importer';
@@ -29,7 +34,7 @@ export const submitSearch = createDataLoadingThunk(
limit: 11,
});
},
(data, { dispatch }) => {
async (data, { dispatch }) => {
if (data.accounts.length > 0) {
dispatch(importFetchedAccounts(data.accounts));
dispatch(fetchRelationships(data.accounts.map((account) => account.id)));
@@ -39,6 +44,11 @@ export const submitSearch = createDataLoadingThunk(
dispatch(importFetchedStatuses(data.statuses));
}
if (data.collections.length > 0) {
dispatch(importFetchedCollections(data.collections));
await fetchAccountsForCollectionPreview(data.collections, dispatch);
}
return data;
},
{
@@ -60,7 +70,7 @@ export const expandSearch = createDataLoadingThunk(
offset,
});
},
(data, { dispatch }) => {
async (data, { dispatch }) => {
if (data.accounts.length > 0) {
dispatch(importFetchedAccounts(data.accounts));
dispatch(fetchRelationships(data.accounts.map((account) => account.id)));
@@ -70,6 +80,11 @@ export const expandSearch = createDataLoadingThunk(
dispatch(importFetchedStatuses(data.statuses));
}
if (data.collections.length > 0) {
dispatch(importFetchedCollections(data.collections));
await fetchAccountsForCollectionPreview(data.collections, dispatch);
}
return data;
},
{