diff options
author | Eric Bailey <git@esb.lol> | 2024-05-30 23:56:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 05:56:09 +0100 |
commit | d614f6cb71bf2751834dbd800b5f43257d5c074a (patch) | |
tree | f33f56f7daf3cb844bd45610eb24bf51326f5ffc /src/state/queries/notifications/feed.ts | |
parent | 89c9fd3be16ea96182842544d76ce019cb8e1403 (diff) | |
download | voidsky-d614f6cb71bf2751834dbd800b5f43257d5c074a.tar.zst |
Shadows (#4265)
Diffstat (limited to 'src/state/queries/notifications/feed.ts')
-rw-r--r-- | src/state/queries/notifications/feed.ts | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/state/queries/notifications/feed.ts b/src/state/queries/notifications/feed.ts index 523af2824..40be2ce8e 100644 --- a/src/state/queries/notifications/feed.ts +++ b/src/state/queries/notifications/feed.ts @@ -17,7 +17,7 @@ */ import {useEffect, useRef} from 'react' -import {AppBskyFeedDefs} from '@atproto/api' +import {AppBskyActorDefs, AppBskyFeedDefs} from '@atproto/api' import { InfiniteData, QueryClient, @@ -162,3 +162,28 @@ export function* findAllPostsInQueryData( } } } + +export function* findAllProfilesInQueryData( + queryClient: QueryClient, + did: string, +): Generator<AppBskyActorDefs.ProfileView, void> { + const queryDatas = queryClient.getQueriesData<InfiniteData<FeedPage>>({ + queryKey: [RQKEY_ROOT], + }) + for (const [_queryKey, queryData] of queryDatas) { + if (!queryData?.pages) { + continue + } + for (const page of queryData?.pages) { + for (const item of page.items) { + if (item.subject?.author.did === did) { + yield item.subject.author + } + const quotedPost = getEmbeddedPost(item.subject?.embed) + if (quotedPost?.author.did === did) { + yield quotedPost.author + } + } + } + } +} |