From 3ac8910cb7ffd531ec7b8c766ac6e19599ae7394 Mon Sep 17 00:00:00 2001 From: Essem Date: Sat, 30 Nov 2024 14:34:42 -0600 Subject: [PATCH] Show public limit comment on remote user profiles when their instance is limited --- .../flavours/glitch/api_types/accounts.ts | 1 + .../components/limited_account_hint.tsx | 39 ++++++++++++++----- .../features/account_timeline/index.jsx | 5 ++- .../flavours/glitch/locales/en.json | 2 + .../flavours/glitch/models/account.ts | 1 + app/models/account.rb | 7 ++++ app/serializers/rest/account_serializer.rb | 5 +++ 7 files changed, 48 insertions(+), 12 deletions(-) diff --git a/app/javascript/flavours/glitch/api_types/accounts.ts b/app/javascript/flavours/glitch/api_types/accounts.ts index fdbd7523fc15cd..cee7e41e779356 100644 --- a/app/javascript/flavours/glitch/api_types/accounts.ts +++ b/app/javascript/flavours/glitch/api_types/accounts.ts @@ -42,6 +42,7 @@ export interface BaseApiAccountJSON { moved?: ApiAccountJSON; suspended?: boolean; limited?: boolean; + remote_limit_reason?: string; memorial?: boolean; hide_collections: boolean; } diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.tsx b/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.tsx index 5613811d2f9c97..0ac5c8bd86c1e1 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.tsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/limited_account_hint.tsx @@ -7,23 +7,42 @@ import { Button } from 'flavours/glitch/components/button'; import { domain } from 'flavours/glitch/initial_state'; import { useAppDispatch } from 'flavours/glitch/store'; -export const LimitedAccountHint: React.FC<{ accountId: string }> = ({ - accountId, -}) => { +export const LimitedAccountHint: React.FC<{ + accountId: string; + reason: string; +}> = ({ accountId, reason }) => { const dispatch = useAppDispatch(); const reveal = useCallback(() => { dispatch(revealAccount({ id: accountId })); }, [dispatch, accountId]); + const message = reason ? ( +

+ +
+ +

+ ) : ( +

+ +

+ ); + return (
-

- -

+ {message}