[Glitch] Fix "unlisted collections" profile section can be visible to other users

Port 96e23af89258068d05cc8557df914b4a9add385b to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion 2026-06-11 12:15:34 +02:00 committed by Claire
parent 704e570dfb
commit 99ef947f96

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