An ATproto social media client -- with an independent Appview.

chore: merge from upstream at 2025-09-16-011555

+11 -42
+11 -42
src/state/feed-feedback.tsx
··· 28 28 29 29 export const FEEDBACK_FEEDS = [...PROD_FEEDS, ...STAGING_FEEDS] 30 30 31 - export const PASSIVE_FEEDBACK_INTERACTIONS = [ 32 - 'app.bsky.feed.defs#clickthroughItem', 33 - 'app.bsky.feed.defs#clickthroughAuthor', 34 - 'app.bsky.feed.defs#clickthroughReposter', 35 - 'app.bsky.feed.defs#clickthroughEmbed', 36 - 'app.bsky.feed.defs#interactionSeen', 37 - ] as const 38 - 39 - export type PassiveFeedbackInteraction = 40 - (typeof PASSIVE_FEEDBACK_INTERACTIONS)[number] 41 - 42 - export const DIRECT_FEEDBACK_INTERACTIONS = [ 43 - 'app.bsky.feed.defs#requestLess', 44 - 'app.bsky.feed.defs#requestMore', 45 - ] as const 46 - 47 - export type DirectFeedbackInteraction = 48 - (typeof DIRECT_FEEDBACK_INTERACTIONS)[number] 49 - 50 - export const ALL_FEEDBACK_INTERACTIONS = [ 51 - ...PASSIVE_FEEDBACK_INTERACTIONS, 52 - ...DIRECT_FEEDBACK_INTERACTIONS, 53 - ] as const 54 - 55 - export type FeedbackInteraction = (typeof ALL_FEEDBACK_INTERACTIONS)[number] 56 - 57 - export function isFeedbackInteraction( 58 - interactionEvent: string, 59 - ): interactionEvent is FeedbackInteraction { 60 - return ALL_FEEDBACK_INTERACTIONS.includes( 61 - interactionEvent as FeedbackInteraction, 62 - ) 63 - } 31 + export const DIRECT_FEEDBACK_INTERACTIONS = new Set< 32 + AppBskyFeedDefs.Interaction['event'] 33 + >(['app.bsky.feed.defs#requestLess', 'app.bsky.feed.defs#requestMore']) 64 34 65 35 const logger = Logger.create(Logger.Context.FeedFeedback) 66 36 ··· 97 67 const proxyDid = feed?.view?.did 98 68 const enabled = 99 69 Boolean(feed) && Boolean(proxyDid) && acceptsInteractions && hasSession 100 - const enabledInteractions = getEnabledInteractions(enabled, feed, isDiscover) 101 70 102 71 const queue = useRef<Set<string>>(new Set()) 103 72 const history = useRef< ··· 123 92 const interactionsToSend = interactions.filter( 124 93 interaction => 125 94 interaction.event && 126 - isFeedbackInteraction(interaction.event) && 127 - enabledInteractions.includes(interaction.event), 95 + isInteractionAllowed(enabled, feed, interaction.event), 128 96 ) 129 97 130 98 if (interactionsToSend.length === 0) { ··· 158 126 ) 159 127 throttledFlushAggregatedStats() 160 128 logger.debug('flushed') 161 - }, [agent, throttledFlushAggregatedStats, proxyDid, enabledInteractions]) 129 + }, [agent, throttledFlushAggregatedStats, proxyDid, enabled, feed]) 162 130 163 131 const sendToFeed = useMemo( 164 132 () => ··· 251 219 return !!feed && FEEDBACK_FEEDS.includes(feed) 252 220 } 253 221 254 - function getEnabledInteractions( 222 + function isInteractionAllowed( 255 223 enabled: boolean, 256 224 feed: FeedSourceFeedInfo | undefined, 257 - isDiscover: boolean, 258 - ): readonly FeedbackInteraction[] { 225 + interaction: AppBskyFeedDefs.Interaction['event'], 226 + ) { 259 227 if (!enabled || !feed) { 260 - return [] 228 + return false 261 229 } 262 - return isDiscover ? ALL_FEEDBACK_INTERACTIONS : DIRECT_FEEDBACK_INTERACTIONS 230 + const isDiscover = isDiscoverFeed(feed.feedDescriptor) 231 + return isDiscover ? true : DIRECT_FEEDBACK_INTERACTIONS.has(interaction) 263 232 } 264 233 265 234 function toString(interaction: AppBskyFeedDefs.Interaction): string {