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