Display toast after reacting emoji reaction limit (#10799)

This commit is contained in:
DS Boyce
2026-06-09 09:36:35 -07:00
committed by GitHub
parent 986cf62da1
commit 750c55eff8
4 changed files with 29 additions and 8 deletions
+14 -1
View File
@@ -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',