diff --git a/app/javascript/mastodon/features/ui/components/domain_block_modal.tsx b/app/javascript/mastodon/features/ui/components/domain_block_modal.tsx index 7e6715990e0..ec089911441 100644 --- a/app/javascript/mastodon/features/ui/components/domain_block_modal.tsx +++ b/app/javascript/mastodon/features/ui/components/domain_block_modal.tsx @@ -30,9 +30,9 @@ export const DomainBlockModal: React.FC<{ }> = ({ domain, accountId, acct }) => { const dispatch = useAppDispatch(); const [loading, setLoading] = useState(true); - const [preview, setPreview] = useState( - null, - ); + const [preview, setPreview] = useState< + DomainBlockPreviewResponse | 'error' | null + >(null); const handleClick = useCallback(() => { if (loading) { @@ -65,6 +65,7 @@ export const DomainBlockModal: React.FC<{ return ''; }) .catch(() => { + setPreview('error'); setLoading(false); }); }, [setPreview, setLoading, domain]); @@ -89,7 +90,35 @@ export const DomainBlockModal: React.FC<{
- {preview && preview.followers_count + preview.following_count > 0 && ( + {preview && + preview !== 'error' && + preview.followers_count + preview.following_count > 0 && ( +
+
+ +
+
+ + + ), + followingCount: preview.following_count, + followingCountDisplay: ( + + ), + }} + /> + +
+
+ )} + + {preview === 'error' && (
@@ -97,18 +126,8 @@ export const DomainBlockModal: React.FC<{
- ), - followingCount: preview.following_count, - followingCountDisplay: ( - - ), - }} + id='domain_block_modal.you_will_lose_relationships' + defaultMessage='You will lose all followers and people you follow from this server.' />
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 0dc4ccee804..b20934388cc 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -222,6 +222,7 @@ "domain_block_modal.they_wont_know": "They won't know they've been blocked.", "domain_block_modal.title": "Block domain?", "domain_block_modal.you_will_lose_num_followers": "You will lose {followersCount, plural, one {{followersCountDisplay} follower} other {{followersCountDisplay} followers}} and {followingCount, plural, one {{followingCountDisplay} person you follow} other {{followingCountDisplay} people you follow}}.", + "domain_block_modal.you_will_lose_relationships": "You will lose all followers and people you follow from this server.", "domain_block_modal.you_wont_see_posts": "You won't see posts or notifications from users on this server.", "domain_pill.activitypub_lets_connect": "It lets you connect and interact with people not just on Mastodon, but across different social apps too.", "domain_pill.activitypub_like_language": "ActivityPub is like the language Mastodon speaks with other social networks.",