Bluesky app fork with some witchin' additions 💫 witchsky.app
bluesky fork client

Add attribution for starter pack follows (#9834)

authored by samuel.fm and committed by

GitHub 3be1f5ca 18eea81e

+22 -7
+7 -4
src/screens/Onboarding/StepFinished/index.tsx
··· 96 96 const {selectedInterests} = interestsStepResults 97 97 98 98 await Promise.all([ 99 - bulkWriteFollows(agent, [ 100 - BSKY_APP_ACCOUNT_DID, 101 - ...(listItems?.map(i => i.subject.did) ?? []), 102 - ]), 99 + bulkWriteFollows( 100 + agent, 101 + [BSKY_APP_ACCOUNT_DID, ...(listItems?.map(i => i.subject.did) ?? [])], 102 + starterPack 103 + ? {uri: starterPack.uri, cid: starterPack.cid} 104 + : undefined, 105 + ), 103 106 (async () => { 104 107 // Interests need to get saved first, then we can write the feeds to prefs 105 108 await agent.setInterestsPref({tags: selectedInterests})
+4 -1
src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx
··· 72 72 73 73 let followUris: Map<string, string> 74 74 try { 75 - followUris = await bulkWriteFollows(agent, dids) 75 + followUris = await bulkWriteFollows(agent, dids, { 76 + uri: view.uri, 77 + cid: view.cid, 78 + }) 76 79 } catch (e) { 77 80 setIsProcessing(false) 78 81 Toast.show(_(msg`An error occurred while trying to follow all`), {
+7 -1
src/screens/Onboarding/util.ts
··· 4 4 type AppBskyGraphGetFollows, 5 5 type BskyAgent, 6 6 type ComAtprotoRepoApplyWrites, 7 + type ComAtprotoRepoStrongRef, 7 8 } from '@atproto/api' 8 9 import {TID} from '@atproto/common-web' 9 10 import chunk from 'lodash.chunk' 10 11 11 12 import {until} from '#/lib/async/until' 12 13 13 - export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) { 14 + export async function bulkWriteFollows( 15 + agent: BskyAgent, 16 + dids: string[], 17 + via?: ComAtprotoRepoStrongRef.Main, 18 + ) { 14 19 const session = agent.session 15 20 16 21 if (!session) { ··· 22 27 $type: 'app.bsky.graph.follow', 23 28 subject: did, 24 29 createdAt: new Date().toISOString(), 30 + via, 25 31 } 26 32 }) 27 33
+4 -1
src/screens/StarterPack/StarterPackScreen.tsx
··· 372 372 373 373 let followUris: Map<string, string> 374 374 try { 375 - followUris = await bulkWriteFollows(agent, dids) 375 + followUris = await bulkWriteFollows(agent, dids, { 376 + uri: starterPack.uri, 377 + cid: starterPack.cid, 378 + }) 376 379 } catch (e) { 377 380 setIsProcessing(false) 378 381 Toast.show(_(msg`An error occurred while trying to follow all`), 'xmark')