diff --git a/src/screens/Onboarding/StepFinished/index.tsx b/src/screens/Onboarding/StepFinished/index.tsx index 5f0d42b3aa..58b84512b4 100644 --- a/src/screens/Onboarding/StepFinished/index.tsx +++ b/src/screens/Onboarding/StepFinished/index.tsx @@ -96,10 +96,13 @@ export function StepFinished() { const {selectedInterests} = interestsStepResults await Promise.all([ - bulkWriteFollows(agent, [ - BSKY_APP_ACCOUNT_DID, - ...(listItems?.map(i => i.subject.did) ?? []), - ]), + bulkWriteFollows( + agent, + [BSKY_APP_ACCOUNT_DID, ...(listItems?.map(i => i.subject.did) ?? [])], + starterPack + ? {uri: starterPack.uri, cid: starterPack.cid} + : undefined, + ), (async () => { // Interests need to get saved first, then we can write the feeds to prefs await agent.setInterestsPref({tags: selectedInterests}) diff --git a/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx b/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx index 3ee9cbe52a..f4c3b09e43 100644 --- a/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx +++ b/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx @@ -72,7 +72,10 @@ export function StarterPackCard({ let followUris: Map try { - followUris = await bulkWriteFollows(agent, dids) + followUris = await bulkWriteFollows(agent, dids, { + uri: view.uri, + cid: view.cid, + }) } catch (e) { setIsProcessing(false) Toast.show(_(msg`An error occurred while trying to follow all`), { diff --git a/src/screens/Onboarding/util.ts b/src/screens/Onboarding/util.ts index b08f0408eb..acb96ee914 100644 --- a/src/screens/Onboarding/util.ts +++ b/src/screens/Onboarding/util.ts @@ -4,13 +4,18 @@ import { type AppBskyGraphGetFollows, type BskyAgent, type ComAtprotoRepoApplyWrites, + type ComAtprotoRepoStrongRef, } from '@atproto/api' import {TID} from '@atproto/common-web' import chunk from 'lodash.chunk' import {until} from '#/lib/async/until' -export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) { +export async function bulkWriteFollows( + agent: BskyAgent, + dids: string[], + via?: ComAtprotoRepoStrongRef.Main, +) { const session = agent.session if (!session) { @@ -22,6 +27,7 @@ export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) { $type: 'app.bsky.graph.follow', subject: did, createdAt: new Date().toISOString(), + via, } }) diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx index 4dc9cde927..4e4dd1a372 100644 --- a/src/screens/StarterPack/StarterPackScreen.tsx +++ b/src/screens/StarterPack/StarterPackScreen.tsx @@ -372,7 +372,10 @@ function Header({ let followUris: Map try { - followUris = await bulkWriteFollows(agent, dids) + followUris = await bulkWriteFollows(agent, dids, { + uri: starterPack.uri, + cid: starterPack.cid, + }) } catch (e) { setIsProcessing(false) Toast.show(_(msg`An error occurred while trying to follow all`), 'xmark')