Bluesky app fork with some witchin' additions 💫

Remove .withProxy() calls (#4929)

authored by danabra.mov and committed by

GitHub 7e11b862 1fce7a79

+40 -85
+11 -24
src/components/ReportDialog/SubmitView.tsx
··· 6 6 7 7 import {getLabelingServiceTitle} from '#/lib/moderation' 8 8 import {ReportOption} from '#/lib/moderation/useReportOptions' 9 - import {useGate} from '#/lib/statsig/statsig' 10 9 import {useAgent} from '#/state/session' 11 10 import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' 12 11 import * as Toast from '#/view/com/util/Toast' ··· 37 36 const t = useTheme() 38 37 const {_} = useLingui() 39 38 const agent = useAgent() 40 - const gate = useGate() 41 39 const [details, setDetails] = React.useState<string>('') 42 40 const [submitting, setSubmitting] = React.useState<boolean>(false) 43 41 const [selectedServices, setSelectedServices] = React.useState<string[]>([ ··· 63 61 } 64 62 const results = await Promise.all( 65 63 selectedServices.map(did => { 66 - if (gate('session_withproxy_fix')) { 67 - return agent 68 - .createModerationReport(report, { 69 - encoding: 'application/json', 70 - headers: { 71 - 'atproto-proxy': `${did}#atproto_labeler`, 72 - }, 73 - }) 74 - .then( 75 - _ => true, 76 - _ => false, 77 - ) 78 - } else { 79 - return agent 80 - .withProxy('atproto_labeler', did) 81 - .createModerationReport(report) 82 - .then( 83 - _ => true, 84 - _ => false, 85 - ) 86 - } 64 + return agent 65 + .createModerationReport(report, { 66 + encoding: 'application/json', 67 + headers: { 68 + 'atproto-proxy': `${did}#atproto_labeler`, 69 + }, 70 + }) 71 + .then( 72 + _ => true, 73 + _ => false, 74 + ) 87 75 }), 88 76 ) 89 77 ··· 108 96 onSubmitComplete, 109 97 setError, 110 98 agent, 111 - gate, 112 99 ]) 113 100 114 101 return (
+14 -29
src/components/moderation/LabelsOnMeDialog.tsx
··· 7 7 8 8 import {useLabelInfo} from '#/lib/moderation/useLabelInfo' 9 9 import {makeProfileLink} from '#/lib/routes/links' 10 - import {useGate} from '#/lib/statsig/statsig' 11 10 import {sanitizeHandle} from '#/lib/strings/handles' 12 11 import {logger} from '#/logger' 13 12 import {useAgent, useSession} from '#/state/session' ··· 204 203 const [details, setDetails] = React.useState('') 205 204 const isAccountReport = 'did' in subject 206 205 const agent = useAgent() 207 - const gate = useGate() 208 206 const sourceName = labeler 209 207 ? sanitizeHandle(labeler.creator.handle, '@') 210 208 : label.src ··· 214 212 const $type = !isAccountReport 215 213 ? 'com.atproto.repo.strongRef' 216 214 : 'com.atproto.admin.defs#repoRef' 217 - if (gate('session_withproxy_fix')) { 218 - await agent.createModerationReport( 219 - { 220 - reasonType: ComAtprotoModerationDefs.REASONAPPEAL, 221 - subject: { 222 - $type, 223 - ...subject, 224 - }, 225 - reason: details, 215 + await agent.createModerationReport( 216 + { 217 + reasonType: ComAtprotoModerationDefs.REASONAPPEAL, 218 + subject: { 219 + $type, 220 + ...subject, 226 221 }, 227 - { 228 - encoding: 'application/json', 229 - headers: { 230 - 'atproto-proxy': `${label.src}#atproto_labeler`, 231 - }, 222 + reason: details, 223 + }, 224 + { 225 + encoding: 'application/json', 226 + headers: { 227 + 'atproto-proxy': `${label.src}#atproto_labeler`, 232 228 }, 233 - ) 234 - } else { 235 - await agent 236 - .withProxy('atproto_labeler', label.src) 237 - .createModerationReport({ 238 - reasonType: ComAtprotoModerationDefs.REASONAPPEAL, 239 - subject: { 240 - $type, 241 - ...subject, 242 - }, 243 - reason: details, 244 - }) 245 - } 229 + }, 230 + ) 246 231 }, 247 232 onError: err => { 248 233 logger.error('Failed to submit label appeal', {message: err})
-1
src/lib/statsig/gates.ts
··· 3 3 | 'debug_show_feedcontext' 4 4 | 'new_user_guided_tour' 5 5 | 'onboarding_minimum_interests' 6 - | 'session_withproxy_fix' 7 6 | 'show_follow_back_label_v2' 8 7 | 'suggested_feeds_interstitial' 9 8 | 'video_debug'
+15 -31
src/state/feed-feedback.tsx
··· 1 1 import React from 'react' 2 2 import {AppState, AppStateStatus} from 'react-native' 3 - import {AppBskyFeedDefs, BskyAgent} from '@atproto/api' 3 + import {AppBskyFeedDefs} from '@atproto/api' 4 4 import throttle from 'lodash.throttle' 5 5 6 6 import {PROD_DEFAULT_FEED} from '#/lib/constants' 7 7 import {logEvent} from '#/lib/statsig/statsig' 8 - import {useGate} from '#/lib/statsig/statsig' 9 8 import {logger} from '#/logger' 10 9 import {FeedDescriptor, FeedPostSliceItem} from '#/state/queries/post-feed' 11 10 import {getFeedPostSlice} from '#/view/com/posts/Feed' ··· 25 24 26 25 export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) { 27 26 const agent = useAgent() 28 - const gate = useGate() 29 27 const enabled = isDiscoverFeed(feed) && hasSession 30 28 const queue = React.useRef<Set<string>>(new Set()) 31 29 const history = React.useRef< ··· 49 47 queue.current.clear() 50 48 51 49 // Send to the feed 52 - if (gate('session_withproxy_fix')) { 53 - agent.app.bsky.feed 54 - .sendInteractions( 55 - {interactions}, 56 - { 57 - encoding: 'application/json', 58 - headers: { 59 - // TODO when we start sending to other feeds, we need to grab their DID -prf 60 - 'atproto-proxy': 'did:web:discover.bsky.app#bsky_fg', 61 - }, 50 + agent.app.bsky.feed 51 + .sendInteractions( 52 + {interactions}, 53 + { 54 + encoding: 'application/json', 55 + headers: { 56 + // TODO when we start sending to other feeds, we need to grab their DID -prf 57 + 'atproto-proxy': 'did:web:discover.bsky.app#bsky_fg', 62 58 }, 63 - ) 64 - .catch((e: any) => { 65 - logger.warn('Failed to send feed interactions', {error: e}) 66 - }) 67 - } else { 68 - const proxyAgent = agent.withProxy( 69 - // @ts-ignore TODO need to update withProxy() to support this key -prf 70 - 'bsky_fg', 71 - // TODO when we start sending to other feeds, we need to grab their DID -prf 72 - 'did:web:discover.bsky.app', 73 - ) as BskyAgent 74 - proxyAgent.app.bsky.feed 75 - .sendInteractions({interactions}) 76 - .catch((e: any) => { 77 - logger.warn('Failed to send feed interactions', {error: e}) 78 - }) 79 - } 59 + }, 60 + ) 61 + .catch((e: any) => { 62 + logger.warn('Failed to send feed interactions', {error: e}) 63 + }) 80 64 81 65 // Send to Statsig 82 66 if (aggregatedStats.current === null) { ··· 84 68 } 85 69 sendOrAggregateInteractionsForStats(aggregatedStats.current, interactions) 86 70 throttledFlushAggregatedStats() 87 - }, [agent, gate, throttledFlushAggregatedStats]) 71 + }, [agent, throttledFlushAggregatedStats]) 88 72 89 73 const sendToFeed = React.useMemo( 90 74 () =>