From 750c55eff8ce1d4775796124970bfb3d86a200de Mon Sep 17 00:00:00 2001 From: DS Boyce <260543580+ds-boyce@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:36:35 -0700 Subject: [PATCH] Display toast after reacting emoji reaction limit (#10799) --- eslint-suppressions.json | 5 ----- src/components/dms/ActionsWrapper.web.tsx | 15 ++++++++++++++- src/components/dms/MessageContextMenu.tsx | 15 ++++++++++++++- src/components/dms/MessageItem.tsx | 2 +- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 59b062cc7b..559f1e564d 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -707,11 +707,6 @@ "count": 1 } }, - "src/components/dms/MessageItem.tsx": { - "@typescript-eslint/no-misused-promises": { - "count": 1 - } - }, "src/components/forms/DateField/index.web.tsx": { "@typescript-eslint/no-explicit-any": { "count": 1 diff --git a/src/components/dms/ActionsWrapper.web.tsx b/src/components/dms/ActionsWrapper.web.tsx index b89712bd1f..9ea12d7f9e 100644 --- a/src/components/dms/ActionsWrapper.web.tsx +++ b/src/components/dms/ActionsWrapper.web.tsx @@ -1,8 +1,10 @@ import {useCallback, useRef, useState} from 'react' import {Pressable, View} from 'react-native' import {type ChatBskyConvoDefs, type ModerationOpts} from '@atproto/api' +import {plural} from '@lingui/core/macro' import {useLingui} from '@lingui/react/macro' +import {EMOJI_REACTION_LIMIT} from '#/lib/constants' import {useMaybeProfileShadow} from '#/state/cache/profile-shadow' import {useConvoActive} from '#/state/messages/convo' import {useSession} from '#/state/session' @@ -72,7 +74,18 @@ export function ActionsWrapper({ .removeReaction(message.id, emoji) .catch(() => Toast.show(l`Failed to remove emoji reaction`)) } else { - if (hasReachedReactionLimit(message, currentAccount?.did)) return + if (hasReachedReactionLimit(message, currentAccount?.did)) { + Toast.show( + l`You cannot add more than ${plural(EMOJI_REACTION_LIMIT, { + one: '# emoji reaction', + other: '# emoji reactions', + })}`, + { + type: 'info', + }, + ) + return + } convo.addReaction(message.id, emoji).catch(() => Toast.show(l`Failed to add emoji reaction`, { type: 'error', diff --git a/src/components/dms/MessageContextMenu.tsx b/src/components/dms/MessageContextMenu.tsx index bc77c5bd79..7cd4febd5f 100644 --- a/src/components/dms/MessageContextMenu.tsx +++ b/src/components/dms/MessageContextMenu.tsx @@ -6,8 +6,10 @@ import { type ModerationOpts, RichText, } from '@atproto/api' +import {plural} from '@lingui/core/macro' import {useLingui} from '@lingui/react/macro' +import {EMOJI_REACTION_LIMIT} from '#/lib/constants' import {useGoogleTranslate} from '#/lib/hooks/useGoogleTranslate' import {richTextToString} from '#/lib/strings/rich-text-helpers' import {useMaybeProfileShadow} from '#/state/cache/profile-shadow' @@ -98,7 +100,18 @@ export let MessageContextMenu = ({ .removeReaction(message.id, emoji) .catch(() => Toast.show(l`Failed to remove emoji reaction`)) } else { - if (hasReachedReactionLimit(message, currentAccount?.did)) return + if (hasReachedReactionLimit(message, currentAccount?.did)) { + Toast.show( + l`You cannot add more than ${plural(EMOJI_REACTION_LIMIT, { + one: '# emoji reaction', + other: '# emoji reactions', + })}`, + { + type: 'info', + }, + ) + return + } convo.addReaction(message.id, emoji).catch(() => Toast.show(l`Failed to add emoji reaction`, { type: 'error', diff --git a/src/components/dms/MessageItem.tsx b/src/components/dms/MessageItem.tsx index f4f3cdacc3..e4081d590a 100644 --- a/src/components/dms/MessageItem.tsx +++ b/src/components/dms/MessageItem.tsx @@ -641,7 +641,7 @@ function BlockedPlaceholder({ {}} cta={l`Okay`} color="primary" /> {profile.viewer?.blocking && !profile.viewer.blockingByList && ( queueUnblock()} + onPress={() => void queueUnblock()} cta={l`Unblock`} color="secondary" />