about summary refs log tree commit diff
path: root/src/state/shell/composer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/shell/composer.tsx')
-rw-r--r--src/state/shell/composer.tsx27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/state/shell/composer.tsx b/src/state/shell/composer.tsx
index c99005489..74802a993 100644
--- a/src/state/shell/composer.tsx
+++ b/src/state/shell/composer.tsx
@@ -5,8 +5,11 @@ import {
   AppBskyRichtextFacet,
   ModerationDecision,
 } from '@atproto/api'
+import {msg} from '@lingui/macro'
+import {useLingui} from '@lingui/react'
 
 import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
+import * as Toast from '#/view/com/util/Toast'
 
 export interface ComposerOptsPostRef {
   uri: string
@@ -22,12 +25,7 @@ export interface ComposerOptsQuote {
   text: string
   facets?: AppBskyRichtextFacet.Main[]
   indexedAt: string
-  author: {
-    did: string
-    handle: string
-    displayName?: string
-    avatar?: string
-  }
+  author: AppBskyActorDefs.ProfileViewBasic
   embeds?: AppBskyEmbedRecord.ViewRecord['embeds']
 }
 export interface ComposerOpts {
@@ -56,10 +54,25 @@ const controlsContext = React.createContext<ControlsContext>({
 })
 
 export function Provider({children}: React.PropsWithChildren<{}>) {
+  const {_} = useLingui()
   const [state, setState] = React.useState<StateContext>()
 
   const openComposer = useNonReactiveCallback((opts: ComposerOpts) => {
-    setState(opts)
+    const author = opts.replyTo?.author || opts.quote?.author
+    const isBlocked = Boolean(
+      author &&
+        (author.viewer?.blocking ||
+          author.viewer?.blockedBy ||
+          author.viewer?.blockingByList),
+    )
+    if (isBlocked) {
+      Toast.show(
+        _(msg`Cannot interact with a blocked user`),
+        'exclamation-circle',
+      )
+    } else {
+      setState(opts)
+    }
   })
 
   const closeComposer = useNonReactiveCallback(() => {