Update hardcoded suggested actors (#524)
* Update the hardcoded suggested follows * Update the suggested actors to just use hardcoded list since there's now the foaf systemzio/stable
parent
c5222db38b
commit
df1791bde2
|
@ -34,121 +34,42 @@ export function TEAM_HANDLES(serviceUrl: string) {
|
|||
}
|
||||
|
||||
export const PROD_SUGGESTED_FOLLOWS = [
|
||||
'christina',
|
||||
'wesam',
|
||||
'jim',
|
||||
'ab',
|
||||
'karalabe',
|
||||
'clun',
|
||||
'staltz',
|
||||
'gillian',
|
||||
'karpathy',
|
||||
'zoink',
|
||||
'john',
|
||||
'round',
|
||||
'vex',
|
||||
'umang',
|
||||
'atroyn',
|
||||
'poisonivy',
|
||||
'wongmjane',
|
||||
'lari',
|
||||
'arunwadhwa',
|
||||
'trav',
|
||||
'fred',
|
||||
'offscript',
|
||||
'satnam',
|
||||
'ella',
|
||||
'caspian',
|
||||
'spencer',
|
||||
'nickgrossman',
|
||||
'koji',
|
||||
'avy',
|
||||
'seymourstein',
|
||||
'joelg',
|
||||
'stig',
|
||||
'rabble',
|
||||
'hunterwalk',
|
||||
'evan',
|
||||
'aviral',
|
||||
'tami',
|
||||
'generativist',
|
||||
'gord',
|
||||
'ninjapleasedj',
|
||||
'robotics',
|
||||
'noahjnelson',
|
||||
'vijay',
|
||||
'scottbeale',
|
||||
'daybreakjung',
|
||||
'shelby',
|
||||
'joel',
|
||||
'space',
|
||||
'rish',
|
||||
'simon',
|
||||
'kelly',
|
||||
'maxbittker',
|
||||
'sylphrenetic',
|
||||
'caleb',
|
||||
'jik',
|
||||
'james',
|
||||
'neil',
|
||||
'tippenein',
|
||||
'mandel',
|
||||
'sharding',
|
||||
'tyler',
|
||||
'raymond',
|
||||
'visakanv',
|
||||
'saz',
|
||||
'steph',
|
||||
'ratzlaff',
|
||||
'beth',
|
||||
'weisser',
|
||||
'katherine',
|
||||
'annagat',
|
||||
'an',
|
||||
'kunal',
|
||||
'josh',
|
||||
'lurkshark',
|
||||
'amir',
|
||||
'amyxzh',
|
||||
'danielle',
|
||||
'jack-frazee',
|
||||
'daniellefong',
|
||||
'dystopiabreaker',
|
||||
'morgan',
|
||||
'vibes',
|
||||
'cat',
|
||||
'yuriy',
|
||||
'alvinreyes',
|
||||
'skoot',
|
||||
'patricia',
|
||||
'ara4n',
|
||||
'case',
|
||||
'armand',
|
||||
'ivan',
|
||||
'nicholas',
|
||||
'kelsey',
|
||||
'ericlee',
|
||||
'emily',
|
||||
'jake',
|
||||
'jennijuju',
|
||||
'ian5v',
|
||||
'bnewbold',
|
||||
'jasmine',
|
||||
'chris',
|
||||
'mtclai',
|
||||
'willscott',
|
||||
'michael',
|
||||
'kwkroeger',
|
||||
'broox',
|
||||
'iamrosewang',
|
||||
'jack-morrison',
|
||||
'pwang',
|
||||
'martin',
|
||||
'jack',
|
||||
'jay',
|
||||
'faithlove.art',
|
||||
'danielkoeth.bsky.social',
|
||||
'bsky.app',
|
||||
'jay.bsky.team',
|
||||
'pfrazee.com',
|
||||
'why.bsky.team',
|
||||
'support.bsky.team',
|
||||
'jack.bsky.social',
|
||||
'earthquake.bsky.social',
|
||||
'jamesgunn.bsky.social',
|
||||
'seangunn.bsky.social',
|
||||
'kumail.bsky.social',
|
||||
'craignewmark.bsky.social',
|
||||
'grimes.bsky.social',
|
||||
'xychelsea.tv',
|
||||
'mcq.bsky.social',
|
||||
'mmasnick.bsky.social',
|
||||
'nitasha.bsky.social',
|
||||
'kenklippenstein.bsky.social',
|
||||
'jaypeters.bsky.social',
|
||||
'miyagawa.bsky.social',
|
||||
'anildash.com',
|
||||
'tiffani.bsky.social',
|
||||
'kelseyhightower.com',
|
||||
'aliafonzy.bsky.social',
|
||||
'tszzl.bsky.social',
|
||||
'danabramov.bsky.social',
|
||||
'shinyakato.dev',
|
||||
'karpathy.bsky.social',
|
||||
'lookitup.baby',
|
||||
'brooke.vibe.camp',
|
||||
'mollywhite.net',
|
||||
'amir.blue',
|
||||
'zoink.bsky.social',
|
||||
'moskov.bsky.social',
|
||||
]
|
||||
.map(handle => `${handle}.bsky.social`)
|
||||
.concat(['pfrazee.com', 'divy.zone', 'dholms.xyz', 'why.bsky.world'])
|
||||
export const STAGING_SUGGESTED_FOLLOWS = ['arcalinea', 'paul', 'paul2'].map(
|
||||
handle => `${handle}.staging.bsky.dev`,
|
||||
)
|
||||
|
|
|
@ -19,10 +19,7 @@ export class SuggestedActorsModel {
|
|||
isRefreshing = false
|
||||
hasLoaded = false
|
||||
error = ''
|
||||
hasMore = true
|
||||
loadMoreCursor?: string
|
||||
|
||||
hardCodedSuggestions: SuggestedActor[] | undefined
|
||||
hasMore = false
|
||||
|
||||
// data
|
||||
suggestions: SuggestedActor[] = []
|
||||
|
@ -60,56 +57,10 @@ export class SuggestedActorsModel {
|
|||
}
|
||||
|
||||
loadMore = bundleAsync(async (replace: boolean = false) => {
|
||||
if (!replace && !this.hasMore) {
|
||||
if (this.suggestions.length && !replace) {
|
||||
return
|
||||
}
|
||||
if (replace) {
|
||||
this.hardCodedSuggestions = undefined
|
||||
}
|
||||
this._xLoading(replace)
|
||||
try {
|
||||
let items: SuggestedActor[] = this.suggestions
|
||||
if (replace) {
|
||||
items = []
|
||||
this.loadMoreCursor = undefined
|
||||
}
|
||||
let res
|
||||
do {
|
||||
await this.fetchHardcodedSuggestions()
|
||||
if (this.hardCodedSuggestions && this.hardCodedSuggestions.length > 0) {
|
||||
// pull from the hard-coded suggestions
|
||||
const newItems = this.hardCodedSuggestions.splice(0, this.pageSize)
|
||||
items = items.concat(newItems)
|
||||
this.hasMore = true
|
||||
this.loadMoreCursor = undefined
|
||||
} else {
|
||||
// pull from the PDS' algo
|
||||
res = await this.rootStore.agent.app.bsky.actor.getSuggestions({
|
||||
limit: this.pageSize,
|
||||
cursor: this.loadMoreCursor,
|
||||
})
|
||||
this.loadMoreCursor = res.data.cursor
|
||||
this.hasMore = !!this.loadMoreCursor
|
||||
items = items.concat(
|
||||
res.data.actors.filter(
|
||||
actor => !items.find(i => i.did === actor.did),
|
||||
),
|
||||
)
|
||||
}
|
||||
} while (items.length < this.pageSize && this.hasMore)
|
||||
runInAction(() => {
|
||||
this.suggestions = items
|
||||
})
|
||||
this._xIdle()
|
||||
} catch (e: any) {
|
||||
this._xIdle(e)
|
||||
}
|
||||
})
|
||||
|
||||
async fetchHardcodedSuggestions() {
|
||||
if (this.hardCodedSuggestions) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
// clone the array so we can mutate it
|
||||
const actors = [
|
||||
|
@ -117,20 +68,14 @@ export class SuggestedActorsModel {
|
|||
this.rootStore.session.currentSession?.service || '',
|
||||
),
|
||||
]
|
||||
|
||||
// fetch the profiles in chunks of 25 (the limit allowed by `getProfiles`)
|
||||
let profiles: AppBskyActorDefs.ProfileView[] = []
|
||||
do {
|
||||
const res = await this.rootStore.agent.getProfiles({
|
||||
actors: actors.splice(0, 25),
|
||||
})
|
||||
profiles = profiles.concat(res.data.profiles)
|
||||
} while (actors.length)
|
||||
|
||||
const res = await this.rootStore.agent.getProfiles({
|
||||
actors: shuffle(actors).splice(0, 25),
|
||||
})
|
||||
const {profiles} = res.data
|
||||
this.rootStore.me.follows.hydrateProfiles(profiles)
|
||||
|
||||
runInAction(() => {
|
||||
profiles = profiles.filter(profile => {
|
||||
this.suggestions = profiles.filter(profile => {
|
||||
if (profile.viewer?.following) {
|
||||
return false
|
||||
}
|
||||
|
@ -139,18 +84,12 @@ export class SuggestedActorsModel {
|
|||
}
|
||||
return true
|
||||
})
|
||||
this.hardCodedSuggestions = shuffle(profiles)
|
||||
})
|
||||
} catch (e) {
|
||||
this.rootStore.log.error(
|
||||
'Failed to getProfiles() for suggested follows',
|
||||
{e},
|
||||
)
|
||||
runInAction(() => {
|
||||
this.hardCodedSuggestions = []
|
||||
})
|
||||
this._xIdle()
|
||||
} catch (e: any) {
|
||||
this._xIdle(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// state transitions
|
||||
// =
|
||||
|
|
Loading…
Reference in New Issue