about summary refs log tree commit diff
path: root/src/state
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2025-01-17 12:19:16 -0800
committerGitHub <noreply@github.com>2025-01-17 12:19:16 -0800
commit6f3f11671d526c5d9a454c46f6daf305b588ef4c (patch)
tree972f05af4b3f2fc801ecc7c8e038e6adac7081e9 /src/state
parentec9cafdbbd476228b7ead5360c792c7d37cc5660 (diff)
downloadvoidsky-6f3f11671d526c5d9a454c46f6daf305b588ef4c.tar.zst
tweaks to constants (#7478)
* add did

* use correct did

* typo

* tweak
Diffstat (limited to 'src/state')
-rw-r--r--src/state/feed-feedback.tsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/state/feed-feedback.tsx b/src/state/feed-feedback.tsx
index 02f98ad14..de5157a54 100644
--- a/src/state/feed-feedback.tsx
+++ b/src/state/feed-feedback.tsx
@@ -3,7 +3,7 @@ import {AppState, AppStateStatus} from 'react-native'
 import {AppBskyFeedDefs} from '@atproto/api'
 import throttle from 'lodash.throttle'
 
-import {PROD_DEFAULT_FEED} from '#/lib/constants'
+import {FEEDBACK_FEEDS, STAGING_FEEDS} from '#/lib/constants'
 import {logEvent} from '#/lib/statsig/statsig'
 import {logger} from '#/logger'
 import {FeedDescriptor, FeedPostSliceItem} from '#/state/queries/post-feed'
@@ -25,6 +25,7 @@ const stateContext = React.createContext<StateContext>({
 export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
   const agent = useAgent()
   const enabled = isDiscoverFeed(feed) && hasSession
+
   const queue = React.useRef<Set<string>>(new Set())
   const history = React.useRef<
     // Use a WeakSet so that we don't need to clear it.
@@ -46,6 +47,11 @@ export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
     const interactions = Array.from(queue.current).map(toInteraction)
     queue.current.clear()
 
+    let proxyDid = 'did:web:discover.bsky.app'
+    if (STAGING_FEEDS.includes(feed)) {
+      proxyDid = 'did:web:algo.pop2.bsky.app'
+    }
+
     // Send to the feed
     agent.app.bsky.feed
       .sendInteractions(
@@ -54,7 +60,7 @@ export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
           encoding: 'application/json',
           headers: {
             // TODO when we start sending to other feeds, we need to grab their DID -prf
-            'atproto-proxy': 'did:web:discover.bsky.app#bsky_fg',
+            'atproto-proxy': `${proxyDid}#bsky_fg`,
           },
         },
       )
@@ -68,7 +74,7 @@ export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
     }
     sendOrAggregateInteractionsForStats(aggregatedStats.current, interactions)
     throttledFlushAggregatedStats()
-  }, [agent, throttledFlushAggregatedStats])
+  }, [agent, throttledFlushAggregatedStats, feed])
 
   const sendToFeed = React.useMemo(
     () =>
@@ -155,7 +161,7 @@ export function useFeedFeedbackContext() {
 // place, we're hardcoding it to the discover feed.
 // -prf
 function isDiscoverFeed(feed: FeedDescriptor) {
-  return feed === `feedgen|${PROD_DEFAULT_FEED('whats-hot')}`
+  return FEEDBACK_FEEDS.includes(feed)
 }
 
 function toString(interaction: AppBskyFeedDefs.Interaction): string {