Fix "unlisted collections" profile section can be visible to other users (#39373)

This commit is contained in:
diondiondion 2026-06-11 12:15:34 +02:00 committed by GitHub
parent 48d6940d7f
commit 96e23af892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,6 +41,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
const account = useAccount(accountId); const account = useAccount(accountId);
const { suspended, blockedBy, hidden } = useAccountVisibility(accountId); const { suspended, blockedBy, hidden } = useAccountVisibility(accountId);
const forceEmptyState = suspended || blockedBy || hidden; const forceEmptyState = suspended || blockedBy || hidden;
const isOwnProfile = accountId === me;
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@ -69,10 +70,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
const { listedCollections = [], unlistedCollections = [] } = Object.groupBy( const { listedCollections = [], unlistedCollections = [] } = Object.groupBy(
collections, collections,
(item) => (item) => (item.discoverable ? 'listedCollections' : 'unlistedCollections'),
item.discoverable && !!item.item_count
? 'listedCollections'
: 'unlistedCollections',
); );
const renderListItem = useCallback( const renderListItem = useCallback(
@ -166,7 +164,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
defaultMessage='Collections' defaultMessage='Collections'
/> />
</h2> </h2>
{accountId === me && ( {isOwnProfile && (
<SubheadingLink to='/collections/new' icon={AddIcon}> <SubheadingLink to='/collections/new' icon={AddIcon}>
<FormattedMessage <FormattedMessage
id='account.featured.new_collection' id='account.featured.new_collection'
@ -179,7 +177,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
<ItemList> <ItemList>
<TruncatedListItems <TruncatedListItems
visibleItems={listedCollections} visibleItems={listedCollections}
truncatedItems={unlistedCollections} truncatedItems={isOwnProfile ? unlistedCollections : []}
toggleButton={{ toggleButton={{
title: ( title: (
<FormattedMessage <FormattedMessage