···99import {findAllProfilesInQueryData as findAllProfilesInListConvosQueryData} from '../queries/messages/list-converations'
1010import {findAllProfilesInQueryData as findAllProfilesInMyBlockedAccountsQueryData} from '../queries/my-blocked-accounts'
1111import {findAllProfilesInQueryData as findAllProfilesInMyMutedAccountsQueryData} from '../queries/my-muted-accounts'
1212+import {findAllProfilesInQueryData as findAllProfilesInFeedsQueryData} from '../queries/post-feed'
1213import {findAllProfilesInQueryData as findAllProfilesInPostLikedByQueryData} from '../queries/post-liked-by'
1314import {findAllProfilesInQueryData as findAllProfilesInPostRepostedByQueryData} from '../queries/post-reposted-by'
1515+import {findAllProfilesInQueryData as findAllProfilesInPostThreadQueryData} from '../queries/post-thread'
1416import {findAllProfilesInQueryData as findAllProfilesInProfileQueryData} from '../queries/profile'
1517import {findAllProfilesInQueryData as findAllProfilesInProfileFollowersQueryData} from '../queries/profile-followers'
1618import {findAllProfilesInQueryData as findAllProfilesInProfileFollowsQueryData} from '../queries/profile-follows'
···107109 yield* findAllProfilesInSuggestedFollowsQueryData(queryClient, did)
108110 yield* findAllProfilesInActorSearchQueryData(queryClient, did)
109111 yield* findAllProfilesInListConvosQueryData(queryClient, did)
112112+ yield* findAllProfilesInFeedsQueryData(queryClient, did)
113113+ yield* findAllProfilesInPostThreadQueryData(queryClient, did)
110114}
+26-1
src/state/queries/notifications/feed.ts
···1717 */
18181919import {useEffect, useRef} from 'react'
2020-import {AppBskyFeedDefs} from '@atproto/api'
2020+import {AppBskyActorDefs, AppBskyFeedDefs} from '@atproto/api'
2121import {
2222 InfiniteData,
2323 QueryClient,
···162162 }
163163 }
164164}
165165+166166+export function* findAllProfilesInQueryData(
167167+ queryClient: QueryClient,
168168+ did: string,
169169+): Generator<AppBskyActorDefs.ProfileView, void> {
170170+ const queryDatas = queryClient.getQueriesData<InfiniteData<FeedPage>>({
171171+ queryKey: [RQKEY_ROOT],
172172+ })
173173+ for (const [_queryKey, queryData] of queryDatas) {
174174+ if (!queryData?.pages) {
175175+ continue
176176+ }
177177+ for (const page of queryData?.pages) {
178178+ for (const item of page.items) {
179179+ if (item.subject?.author.did === did) {
180180+ yield item.subject.author
181181+ }
182182+ const quotedPost = getEmbeddedPost(item.subject?.embed)
183183+ if (quotedPost?.author.did === did) {
184184+ yield quotedPost.author
185185+ }
186186+ }
187187+ }
188188+ }
189189+}
+39
src/state/queries/post-feed.ts
···483483 }
484484}
485485486486+export function* findAllProfilesInQueryData(
487487+ queryClient: QueryClient,
488488+ did: string,
489489+): Generator<AppBskyActorDefs.ProfileView, undefined> {
490490+ const queryDatas = queryClient.getQueriesData<
491491+ InfiniteData<FeedPageUnselected>
492492+ >({
493493+ queryKey: [RQKEY_ROOT],
494494+ })
495495+ for (const [_queryKey, queryData] of queryDatas) {
496496+ if (!queryData?.pages) {
497497+ continue
498498+ }
499499+ for (const page of queryData?.pages) {
500500+ for (const item of page.feed) {
501501+ if (item.post.author.did === did) {
502502+ yield item.post.author
503503+ }
504504+ const quotedPost = getEmbeddedPost(item.post.embed)
505505+ if (quotedPost?.author.did === did) {
506506+ yield quotedPost.author
507507+ }
508508+ if (
509509+ AppBskyFeedDefs.isPostView(item.reply?.parent) &&
510510+ item.reply?.parent?.author.did === did
511511+ ) {
512512+ yield item.reply.parent.author
513513+ }
514514+ if (
515515+ AppBskyFeedDefs.isPostView(item.reply?.root) &&
516516+ item.reply?.root?.author.did === did
517517+ ) {
518518+ yield item.reply.root.author
519519+ }
520520+ }
521521+ }
522522+ }
523523+}
524524+486525function assertSomePostsPassModeration(feed: AppBskyFeedDefs.FeedViewPost[]) {
487526 // no posts in this feed
488527 if (feed.length === 0) return true
+46-3
src/state/queries/post-thread.ts
···11import {
22+ AppBskyActorDefs,
23 AppBskyEmbedRecord,
34 AppBskyFeedDefs,
45 AppBskyFeedGetPostThread,
···1112import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
1213import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
1314import {useAgent} from '#/state/session'
1414-import {findAllPostsInQueryData as findAllPostsInSearchQueryData} from 'state/queries/search-posts'
1515-import {findAllPostsInQueryData as findAllPostsInNotifsQueryData} from './notifications/feed'
1616-import {findAllPostsInQueryData as findAllPostsInFeedQueryData} from './post-feed'
1515+import {
1616+ findAllPostsInQueryData as findAllPostsInSearchQueryData,
1717+ findAllProfilesInQueryData as findAllProfilesInSearchQueryData,
1818+} from 'state/queries/search-posts'
1919+import {
2020+ findAllPostsInQueryData as findAllPostsInNotifsQueryData,
2121+ findAllProfilesInQueryData as findAllProfilesInNotifsQueryData,
2222+} from './notifications/feed'
2323+import {
2424+ findAllPostsInQueryData as findAllPostsInFeedQueryData,
2525+ findAllProfilesInQueryData as findAllProfilesInFeedQueryData,
2626+} from './post-feed'
1727import {embedViewRecordToPostView, getEmbeddedPost} from './util'
18281929const RQKEY_ROOT = 'post-thread'
···290300 }
291301 for (let post of findAllPostsInSearchQueryData(queryClient, uri)) {
292302 yield postViewToPlaceholderThread(post)
303303+ }
304304+}
305305+306306+export function* findAllProfilesInQueryData(
307307+ queryClient: QueryClient,
308308+ did: string,
309309+): Generator<AppBskyActorDefs.ProfileView, void> {
310310+ const queryDatas = queryClient.getQueriesData<ThreadNode>({
311311+ queryKey: [RQKEY_ROOT],
312312+ })
313313+ for (const [_queryKey, queryData] of queryDatas) {
314314+ if (!queryData) {
315315+ continue
316316+ }
317317+ for (const item of traverseThread(queryData)) {
318318+ if (item.type === 'post' && item.post.author.did === did) {
319319+ yield item.post.author
320320+ }
321321+ const quotedPost =
322322+ item.type === 'post' ? getEmbeddedPost(item.post.embed) : undefined
323323+ if (quotedPost?.author.did === did) {
324324+ yield quotedPost?.author
325325+ }
326326+ }
327327+ }
328328+ for (let profile of findAllProfilesInFeedQueryData(queryClient, did)) {
329329+ yield profile
330330+ }
331331+ for (let profile of findAllProfilesInNotifsQueryData(queryClient, did)) {
332332+ yield profile
333333+ }
334334+ for (let profile of findAllProfilesInSearchQueryData(queryClient, did)) {
335335+ yield profile
293336 }
294337}
295338
+32-1
src/state/queries/search-posts.ts
···11-import {AppBskyFeedDefs, AppBskyFeedSearchPosts} from '@atproto/api'
11+import {
22+ AppBskyActorDefs,
33+ AppBskyFeedDefs,
44+ AppBskyFeedSearchPosts,
55+} from '@atproto/api'
26import {
37 InfiniteData,
48 QueryClient,
···7579 }
7680 }
7781}
8282+8383+export function* findAllProfilesInQueryData(
8484+ queryClient: QueryClient,
8585+ did: string,
8686+): Generator<AppBskyActorDefs.ProfileView, undefined> {
8787+ const queryDatas = queryClient.getQueriesData<
8888+ InfiniteData<AppBskyFeedSearchPosts.OutputSchema>
8989+ >({
9090+ queryKey: [searchPostsQueryKeyRoot],
9191+ })
9292+ for (const [_queryKey, queryData] of queryDatas) {
9393+ if (!queryData?.pages) {
9494+ continue
9595+ }
9696+ for (const page of queryData?.pages) {
9797+ for (const post of page.posts) {
9898+ if (post.author.did === did) {
9999+ yield post.author
100100+ }
101101+ const quotedPost = getEmbeddedPost(post.embed)
102102+ if (quotedPost?.author.did === did) {
103103+ yield quotedPost.author
104104+ }
105105+ }
106106+ }
107107+ }
108108+}