From c56496d22ee99b84abc387634dd276e5d5dfb203 Mon Sep 17 00:00:00 2001 From: diondiondion Date: Thu, 5 Mar 2026 16:57:27 +0100 Subject: [PATCH] [Glitch] Remove minimum account limit on collections Port 3d8d5f6dc7625d9638cc2e3387247442225d4e3f to glitch-soc Signed-off-by: Claire --- .../features/account_featured/index.tsx | 17 +++-- .../features/collections/editor/accounts.tsx | 73 +++++-------------- 2 files changed, 29 insertions(+), 61 deletions(-) diff --git a/app/javascript/flavours/glitch/features/account_featured/index.tsx b/app/javascript/flavours/glitch/features/account_featured/index.tsx index 0f03f52a3d..fa55a153f6 100644 --- a/app/javascript/flavours/glitch/features/account_featured/index.tsx +++ b/app/javascript/flavours/glitch/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/flavours/glitch/features/collections/editor/accounts.tsx b/app/javascript/flavours/glitch/features/collections/editor/accounts.tsx index abfc54c888..f006c490f3 100644 --- a/app/javascript/flavours/glitch/features/collections/editor/accounts.tsx +++ b/app/javascript/flavours/glitch/features/collections/editor/accounts.tsx @@ -15,7 +15,6 @@ import { Account } from 'flavours/glitch/components/account'; import { Avatar } from 'flavours/glitch/components/avatar'; import { Badge } from 'flavours/glitch/components/badge'; import { Button } from 'flavours/glitch/components/button'; -import { Callout } from 'flavours/glitch/components/callout'; import { DisplayName } from 'flavours/glitch/components/display_name'; import { EmptyState } from 'flavours/glitch/components/empty_state'; import { FormStack, Combobox } from 'flavours/glitch/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}
} +
+
- )} + +
)}