tangled
alpha
login
or
join now
quilling.dev
/
social-app
7
fork
atom
An ATproto social media client -- with an independent Appview.
7
fork
atom
overview
issues
pulls
pipelines
chore: merge from upstream at 2025-09-16-011555
github-actions[bot]
6 months ago
3eff8f84
655552f6
+11
-42
1 changed file
expand all
collapse all
unified
split
src
state
feed-feedback.tsx
+11
-42
src/state/feed-feedback.tsx
···
28
28
29
29
export const FEEDBACK_FEEDS = [...PROD_FEEDS, ...STAGING_FEEDS]
30
30
31
31
-
export const PASSIVE_FEEDBACK_INTERACTIONS = [
32
32
-
'app.bsky.feed.defs#clickthroughItem',
33
33
-
'app.bsky.feed.defs#clickthroughAuthor',
34
34
-
'app.bsky.feed.defs#clickthroughReposter',
35
35
-
'app.bsky.feed.defs#clickthroughEmbed',
36
36
-
'app.bsky.feed.defs#interactionSeen',
37
37
-
] as const
38
38
-
39
39
-
export type PassiveFeedbackInteraction =
40
40
-
(typeof PASSIVE_FEEDBACK_INTERACTIONS)[number]
41
41
-
42
42
-
export const DIRECT_FEEDBACK_INTERACTIONS = [
43
43
-
'app.bsky.feed.defs#requestLess',
44
44
-
'app.bsky.feed.defs#requestMore',
45
45
-
] as const
46
46
-
47
47
-
export type DirectFeedbackInteraction =
48
48
-
(typeof DIRECT_FEEDBACK_INTERACTIONS)[number]
49
49
-
50
50
-
export const ALL_FEEDBACK_INTERACTIONS = [
51
51
-
...PASSIVE_FEEDBACK_INTERACTIONS,
52
52
-
...DIRECT_FEEDBACK_INTERACTIONS,
53
53
-
] as const
54
54
-
55
55
-
export type FeedbackInteraction = (typeof ALL_FEEDBACK_INTERACTIONS)[number]
56
56
-
57
57
-
export function isFeedbackInteraction(
58
58
-
interactionEvent: string,
59
59
-
): interactionEvent is FeedbackInteraction {
60
60
-
return ALL_FEEDBACK_INTERACTIONS.includes(
61
61
-
interactionEvent as FeedbackInteraction,
62
62
-
)
63
63
-
}
31
31
+
export const DIRECT_FEEDBACK_INTERACTIONS = new Set<
32
32
+
AppBskyFeedDefs.Interaction['event']
33
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
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
126
-
isFeedbackInteraction(interaction.event) &&
127
127
-
enabledInteractions.includes(interaction.event),
95
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
161
-
}, [agent, throttledFlushAggregatedStats, proxyDid, enabledInteractions])
129
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
254
-
function getEnabledInteractions(
222
222
+
function isInteractionAllowed(
255
223
enabled: boolean,
256
224
feed: FeedSourceFeedInfo | undefined,
257
257
-
isDiscover: boolean,
258
258
-
): readonly FeedbackInteraction[] {
225
225
+
interaction: AppBskyFeedDefs.Interaction['event'],
226
226
+
) {
259
227
if (!enabled || !feed) {
260
260
-
return []
228
228
+
return false
261
229
}
262
262
-
return isDiscover ? ALL_FEEDBACK_INTERACTIONS : DIRECT_FEEDBACK_INTERACTIONS
230
230
+
const isDiscover = isDiscoverFeed(feed.feedDescriptor)
231
231
+
return isDiscover ? true : DIRECT_FEEDBACK_INTERACTIONS.has(interaction)
263
232
}
264
233
265
234
function toString(interaction: AppBskyFeedDefs.Interaction): string {