From 909096b98a0bf2e7bcb79e79617a2ab1c003b6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sat, 29 Nov 2025 18:45:11 +0100 Subject: [PATCH] pl-fe: display unlisted media in ProfileMediaPanel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../components/panels/profile-media-panel.tsx | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx b/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx index 966835ee4..b0214a427 100644 --- a/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx +++ b/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { FormattedMessage } from 'react-intl'; import Spinner from 'pl-fe/components/ui/spinner'; @@ -22,19 +22,22 @@ const ProfileMediaPanel: React.FC = ({ account }) => { openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); }; - const renderAttachments = () => { - const publicAttachments = attachments.filter(attachment => attachment.visibility === 'public'); - const nineAttachments = publicAttachments.slice(0, 9); + const children = useMemo(() => { + if (isLoading || !account) return ; - if (nineAttachments.length) { + const publicVisibilities = ['public', 'unlisted']; + + const publicAttachments = attachments.filter(attachment => publicVisibilities.includes(attachment.visibility)).slice(0, 9); + + if (publicAttachments.length) { return (
- {nineAttachments.map((attachment, index) => ( + {publicAttachments.map((attachment, index) => ( ))}
@@ -46,15 +49,11 @@ const ProfileMediaPanel: React.FC = ({ account }) => {

); } - }; + }, [isLoading, account?.id, attachments]); return ( }> - {isLoading || !account ? ( - - ) : ( - renderAttachments() - )} + {children} ); };