From 3d8d5f6dc7625d9638cc2e3387247442225d4e3f Mon Sep 17 00:00:00 2001 From: diondiondion Date: Thu, 5 Mar 2026 16:57:27 +0100 Subject: [PATCH] Remove minimum account limit on collections (#38082) --- .../features/account_featured/index.tsx | 17 +++-- .../features/collections/editor/accounts.tsx | 73 +++++-------------- app/javascript/mastodon/locales/en.json | 2 - 3 files changed, 29 insertions(+), 63 deletions(-) diff --git a/app/javascript/mastodon/features/account_featured/index.tsx b/app/javascript/mastodon/features/account_featured/index.tsx index ddb415397f..1172ff3dc5 100644 --- a/app/javascript/mastodon/features/account_featured/index.tsx +++ b/app/javascript/mastodon/features/account_featured/index.tsx @@ -82,10 +82,11 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({ const { collections, status } = useAppSelector((state) => selectAccountCollections(state, accountId ?? null), ); - const publicCollections = collections.filter( - // This filter only applies when viewing your own profile, where the endpoint - // returns all collections, but we hide unlisted ones here to avoid confusion - (item) => item.discoverable, + const listedCollections = collections.filter( + // Hide unlisted and empty collections to avoid confusion + // (Unlisted collections will only be part of the payload + // when viewing your own profile.) + (item) => item.discoverable && !!item.item_count, ); if (accountId === null) { @@ -124,7 +125,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({ {accountId && ( )} - {publicCollections.length > 0 && status === 'idle' && ( + {listedCollections.length > 0 && status === 'idle' && ( <>

= ({ />

- {publicCollections.map((item, index) => ( + {listedCollections.map((item, index) => ( ))} diff --git a/app/javascript/mastodon/features/collections/editor/accounts.tsx b/app/javascript/mastodon/features/collections/editor/accounts.tsx index be4426dfdd..47af9e211c 100644 --- a/app/javascript/mastodon/features/collections/editor/accounts.tsx +++ b/app/javascript/mastodon/features/collections/editor/accounts.tsx @@ -15,7 +15,6 @@ import { Account } from 'mastodon/components/account'; import { Avatar } from 'mastodon/components/avatar'; import { Badge } from 'mastodon/components/badge'; import { Button } from 'mastodon/components/button'; -import { Callout } from 'mastodon/components/callout'; import { DisplayName } from 'mastodon/components/display_name'; import { EmptyState } from 'mastodon/components/empty_state'; import { FormStack, Combobox } from 'mastodon/components/form_fields'; @@ -40,7 +39,6 @@ import { getCollectionEditorState } from './state'; import classes from './styles.module.scss'; import { WizardStepHeader } from './wizard_step_header'; -const MIN_ACCOUNT_COUNT = 1; const MAX_ACCOUNT_COUNT = 25; function isOlderThanAWeek(date?: string): boolean { @@ -164,9 +162,6 @@ export const CollectionAccounts: React.FC<{ ); const hasMaxAccounts = accountIds.length === MAX_ACCOUNT_COUNT; - const hasMinAccounts = accountIds.length === MIN_ACCOUNT_COUNT; - const hasTooFewAccounts = accountIds.length < MIN_ACCOUNT_COUNT; - const canSubmit = !hasTooFewAccounts; const { accountIds: suggestedAccountIds, @@ -319,17 +314,13 @@ export const CollectionAccounts: React.FC<{ (e: React.FormEvent) => { e.preventDefault(); - if (!canSubmit) { - return; - } - if (!id) { history.push(`/collections/new/details`, { account_ids: accountIds, }); } }, - [canSubmit, id, history, accountIds], + [id, history, accountIds], ); const inputId = useId(); @@ -384,16 +375,6 @@ export const CollectionAccounts: React.FC<{ /> )} - {hasMinAccounts && ( - - - - )} - @@ -435,39 +416,25 @@ export const CollectionAccounts: React.FC<{ {!isEditMode && (
- {hasTooFewAccounts ? ( - - - - ) : ( -
- - {(text) => ( -
{text}
- )} -
- {canSubmit && ( - +
+ + {(text) =>
{text}
} +
+
- )} + +
)} diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 6e17ec67db..9f8c883729 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -337,8 +337,6 @@ "collections.edit_details": "Edit details", "collections.error_loading_collections": "There was an error when trying to load your collections.", "collections.hints.accounts_counter": "{count} / {max} accounts", - "collections.hints.add_more_accounts": "Add at least {count, plural, one {# account} other {# accounts}} to continue", - "collections.hints.can_not_remove_more_accounts": "Collections must contain at least {count, plural, one {# account} other {# accounts}}. Removing more accounts is not possible.", "collections.last_updated_at": "Last updated: {date}", "collections.manage_accounts": "Manage accounts", "collections.mark_as_sensitive": "Mark as sensitive",