diff options
author | Hailey <me@haileyok.com> | 2024-06-26 18:57:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-26 18:57:57 -0700 |
commit | 5641a4393c15c666bb95306d722d1ebf805df8ba (patch) | |
tree | 8705c78ed63190ed54b36b72fe87460a596df909 /src/screens/Onboarding/util.ts | |
parent | 878b0476dd94e187504f503438ca8914a48ac630 (diff) | |
download | voidsky-5641a4393c15c666bb95306d722d1ebf805df8ba.tar.zst |
update follows when pressing follow all (#4663)
Diffstat (limited to 'src/screens/Onboarding/util.ts')
-rw-r--r-- | src/screens/Onboarding/util.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/screens/Onboarding/util.ts b/src/screens/Onboarding/util.ts index f3c800d05..b9ecc4b98 100644 --- a/src/screens/Onboarding/util.ts +++ b/src/screens/Onboarding/util.ts @@ -3,6 +3,7 @@ import { AppBskyGraphGetFollows, BskyAgent, } from '@atproto/api' +import {TID} from '@atproto/common-web' import {until} from '#/lib/async/until' @@ -20,9 +21,11 @@ export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) { createdAt: new Date().toISOString(), } }) + const followWrites = followRecords.map(r => ({ $type: 'com.atproto.repo.applyWrites#create', collection: 'app.bsky.graph.follow', + rkey: TID.nextStr(), value: r, })) @@ -31,6 +34,15 @@ export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) { writes: followWrites, }) await whenFollowsIndexed(agent, session.did, res => !!res.data.follows.length) + + const followUris = new Map() + for (const r of followWrites) { + followUris.set( + r.value.subject, + `at://${session.did}/app.bsky.graph.follow/${r.rkey}`, + ) + } + return followUris } async function whenFollowsIndexed( |