From cd9b01095ce32ea68714fc6556d0befb403f4267 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 22 Feb 2023 00:42:43 +0800 Subject: [PATCH] Fix post status banner showing wrong thing for non-logged-in users --- src/pages/status.jsx | 92 ++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index c22e6bc0..8d3a488e 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -40,8 +40,12 @@ function resetScrollPosition(id) { function StatusPage() { const { id, ...params } = useParams(); - const { masto, instance, authenticated } = api({ instance: params.instance }); - const { masto: currentMasto, instance: currentInstance } = api(); + const { masto, instance } = api({ instance: params.instance }); + const { + masto: currentMasto, + instance: currentInstance, + authenticated, + } = api(); const sameInstance = instance === currentInstance; const navigate = useNavigate(); const snapStates = useSnapshot(states); @@ -622,55 +626,59 @@ function StatusPage() { size="l" /> - {!sameInstance && uiState !== 'loading' && ( + {uiState !== 'loading' && !authenticated ? (

- This post is from another instance ( - {instance}). Interactions (reply, boost, etc) - are not possible. + You're not logged in. Interactions (reply, boost, + etc) are not possible.

- + + Log in +
- )} - {sameInstance && - !authenticated && - uiState !== 'loading' && ( + ) : ( + !sameInstance && (

- You're not logged in. Interactions (reply, boost, + This post is from another instance ( + {instance}). Interactions (reply, boost, etc) are not possible.

- - Log in - +
- )} + ) + )} ) : (