Handle hideCollections

This commit is contained in:
Lim Chee Aun 2024-05-16 21:11:51 +08:00
parent 9934daeb4d
commit b0a53b7fa1
2 changed files with 9 additions and 1 deletions

View file

@ -186,6 +186,7 @@ function AccountInfo({
memorial, memorial,
moved, moved,
roles, roles,
hideCollections,
} = info || {}; } = info || {};
let headerIsAvatar = false; let headerIsAvatar = false;
let { header, headerStatic } = info || {}; let { header, headerStatic } = info || {};
@ -677,6 +678,9 @@ function AccountInfo({
excludeRelationshipAttrs: isSelf excludeRelationshipAttrs: isSelf
? ['followedBy'] ? ['followedBy']
: [], : [],
blankCopy: hideCollections
? 'This user has chosen to not make this information available.'
: undefined,
}; };
}, 0); }, 0);
}} }}
@ -712,6 +716,9 @@ function AccountInfo({
fetchAccounts: fetchFollowing, fetchAccounts: fetchFollowing,
instance, instance,
excludeRelationshipAttrs: isSelf ? ['following'] : [], excludeRelationshipAttrs: isSelf ? ['following'] : [],
blankCopy: hideCollections
? 'This user has chosen to not make this information available.'
: undefined,
}; };
}, 0); }, 0);
}} }}

View file

@ -20,6 +20,7 @@ export default function GenericAccounts({
excludeRelationshipAttrs = [], excludeRelationshipAttrs = [],
postID, postID,
onClose = () => {}, onClose = () => {},
blankCopy = 'Nothing to show',
}) { }) {
const { masto, instance: currentInstance } = api(); const { masto, instance: currentInstance } = api();
const isCurrentInstance = instance ? instance === currentInstance : true; const isCurrentInstance = instance ? instance === currentInstance : true;
@ -221,7 +222,7 @@ export default function GenericAccounts({
) : uiState === 'error' ? ( ) : uiState === 'error' ? (
<p class="ui-state">Error loading accounts</p> <p class="ui-state">Error loading accounts</p>
) : ( ) : (
<p class="ui-state insignificant">Nothing to show</p> <p class="ui-state insignificant">{blankCopy}</p>
)} )}
</main> </main>
</div> </div>