about summary refs log tree commit diff
path: root/src/components/moderation/LabelsOnMeDialog.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-07-10 00:12:26 +0100
committerGitHub <noreply@github.com>2024-07-10 00:12:26 +0100
commit9b9e09d0020283b9aee6911e0c96b5ddbb0c87aa (patch)
tree321721bdaf201bf878c2e3e97758f38a9a10e4d5 /src/components/moderation/LabelsOnMeDialog.tsx
parentce0bf867ff3b50a495d8db242a7f55371bffeadc (diff)
downloadvoidsky-9b9e09d0020283b9aee6911e0c96b5ddbb0c87aa.tar.zst
[Session] Experiment: Don't use withProxy (#4762)
* Reorder statements

* Remove withProxy() usage behind a gate
Diffstat (limited to 'src/components/moderation/LabelsOnMeDialog.tsx')
-rw-r--r--src/components/moderation/LabelsOnMeDialog.tsx39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/components/moderation/LabelsOnMeDialog.tsx b/src/components/moderation/LabelsOnMeDialog.tsx
index d0f0d4ea0..c226fbbf7 100644
--- a/src/components/moderation/LabelsOnMeDialog.tsx
+++ b/src/components/moderation/LabelsOnMeDialog.tsx
@@ -7,6 +7,7 @@ import {useMutation} from '@tanstack/react-query'
 
 import {useLabelInfo} from '#/lib/moderation/useLabelInfo'
 import {makeProfileLink} from '#/lib/routes/links'
+import {useGate} from '#/lib/statsig/statsig'
 import {sanitizeHandle} from '#/lib/strings/handles'
 import {logger} from '#/logger'
 import {useAgent, useSession} from '#/state/session'
@@ -201,22 +202,42 @@ function AppealForm({
   const [details, setDetails] = React.useState('')
   const isAccountReport = 'did' in subject
   const agent = useAgent()
+  const gate = useGate()
 
   const {mutate, isPending} = useMutation({
     mutationFn: async () => {
       const $type = !isAccountReport
         ? 'com.atproto.repo.strongRef'
         : 'com.atproto.admin.defs#repoRef'
-      await agent
-        .withProxy('atproto_labeler', label.src)
-        .createModerationReport({
-          reasonType: ComAtprotoModerationDefs.REASONAPPEAL,
-          subject: {
-            $type,
-            ...subject,
+      if (gate('session_withproxy_fix')) {
+        await agent.createModerationReport(
+          {
+            reasonType: ComAtprotoModerationDefs.REASONAPPEAL,
+            subject: {
+              $type,
+              ...subject,
+            },
+            reason: details,
           },
-          reason: details,
-        })
+          {
+            encoding: 'application/json',
+            headers: {
+              'atproto-proxy': `${label.src}#atproto_labeler`,
+            },
+          },
+        )
+      } else {
+        await agent
+          .withProxy('atproto_labeler', label.src)
+          .createModerationReport({
+            reasonType: ComAtprotoModerationDefs.REASONAPPEAL,
+            subject: {
+              $type,
+              ...subject,
+            },
+            reason: details,
+          })
+      }
     },
     onError: err => {
       logger.error('Failed to submit label appeal', {message: err})