about summary refs log tree commit diff
path: root/src/components/ReportDialog/SubmitView.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/ReportDialog/SubmitView.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/ReportDialog/SubmitView.tsx')
-rw-r--r--src/components/ReportDialog/SubmitView.tsx35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/components/ReportDialog/SubmitView.tsx b/src/components/ReportDialog/SubmitView.tsx
index 3731617fd..7ceece75b 100644
--- a/src/components/ReportDialog/SubmitView.tsx
+++ b/src/components/ReportDialog/SubmitView.tsx
@@ -6,6 +6,7 @@ import {useLingui} from '@lingui/react'
 
 import {getLabelingServiceTitle} from '#/lib/moderation'
 import {ReportOption} from '#/lib/moderation/useReportOptions'
+import {useGate} from '#/lib/statsig/statsig'
 import {useAgent} from '#/state/session'
 import {CharProgress} from '#/view/com/composer/char-progress/CharProgress'
 import * as Toast from '#/view/com/util/Toast'
@@ -36,6 +37,7 @@ export function SubmitView({
   const t = useTheme()
   const {_} = useLingui()
   const agent = useAgent()
+  const gate = useGate()
   const [details, setDetails] = React.useState<string>('')
   const [submitting, setSubmitting] = React.useState<boolean>(false)
   const [selectedServices, setSelectedServices] = React.useState<string[]>([
@@ -60,15 +62,29 @@ export function SubmitView({
       reason: details,
     }
     const results = await Promise.all(
-      selectedServices.map(did =>
-        agent
-          .withProxy('atproto_labeler', did)
-          .createModerationReport(report)
-          .then(
-            _ => true,
-            _ => false,
-          ),
-      ),
+      selectedServices.map(did => {
+        if (gate('session_withproxy_fix')) {
+          return agent
+            .createModerationReport(report, {
+              encoding: 'application/json',
+              headers: {
+                'atproto-proxy': `${did}#atproto_labeler`,
+              },
+            })
+            .then(
+              _ => true,
+              _ => false,
+            )
+        } else {
+          return agent
+            .withProxy('atproto_labeler', did)
+            .createModerationReport(report)
+            .then(
+              _ => true,
+              _ => false,
+            )
+        }
+      }),
     )
 
     setSubmitting(false)
@@ -92,6 +108,7 @@ export function SubmitView({
     onSubmitComplete,
     setError,
     agent,
+    gate,
   ])
 
   return (