Only suggest discoverable accounts in collection account editor (#37920)

This commit is contained in:
diondiondion authored and GitHub committed 2026-02-19 16:43:31 +00:00
1 parent 7eb4b907eb
commit 39ff07bc89
5 files changed
+41 -3

No files matched your search

@@ -129,7 +129,11 @@ export const CollectionAccounts: React.FC<{
accountIds: suggestedAccountIds,
isLoading: isLoadingSuggestions,
searchAccounts,
} = useSearchAccounts();
} = useSearchAccounts({
filterResults: (account) =>
// Only suggest accounts who allow being featured/recommended
account.feature_approval.current_user === 'automatic',
});
const suggestedItems = suggestedAccountIds.map((id) => ({
id,
@@ -10,8 +10,10 @@ import { useAppDispatch } from 'mastodon/store';
export function useSearchAccounts({
resetOnInputClear = true,
onSettled,
filterResults,
}: {
onSettled?: (value: string) => void;
filterResults?: (account: ApiAccountJSON) => boolean;
resetOnInputClear?: boolean;
} = {}) {
const dispatch = useAppDispatch();
@@ -49,8 +51,9 @@ export function useSearchAccounts({
},
})
.then((data) => {
dispatch(importFetchedAccounts(data));
setAccountIds(data.map((a) => a.id));
const accounts = filterResults ? data.filter(filterResults) : data;
dispatch(importFetchedAccounts(accounts));
setAccountIds(accounts.map((a) => a.id));
setLoadingState('idle');
onSettled?.(value);
})