[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:
parent
704e570dfb
commit
99ef947f96
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user