This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
const productionSuggestedFollows = [
|
const productionSuggestedFollows = [
|
||||||
'john',
|
'john',
|
||||||
'visakanv ',
|
'visakanv',
|
||||||
'saz ',
|
'saz',
|
||||||
'steph ',
|
'steph',
|
||||||
'ratzlaff ',
|
'ratzlaff',
|
||||||
'beth',
|
'beth',
|
||||||
'weisser ',
|
'weisser',
|
||||||
'katherine ',
|
'katherine',
|
||||||
'annagat',
|
'annagat',
|
||||||
'josh',
|
'josh',
|
||||||
'lurkshark',
|
'lurkshark',
|
||||||
'amir',
|
'amir',
|
||||||
'amyxzh',
|
'amyxzh',
|
||||||
'danielle ',
|
'danielle',
|
||||||
'jack-frazee',
|
'jack-frazee',
|
||||||
'vibes',
|
'vibes',
|
||||||
'cat',
|
'cat',
|
||||||
|
|||||||
@@ -121,28 +121,40 @@ export class SuggestedActorsViewModel {
|
|||||||
})
|
})
|
||||||
|
|
||||||
private async fetchHardcodedSuggestions() {
|
private async fetchHardcodedSuggestions() {
|
||||||
if (!this.hardCodedSuggestions) {
|
if (this.hardCodedSuggestions) {
|
||||||
try {
|
return
|
||||||
const suggestionsList = getSuggestionList({
|
}
|
||||||
|
try {
|
||||||
|
// clone the array so we can mutate it
|
||||||
|
const actors = [
|
||||||
|
...getSuggestionList({
|
||||||
serviceUrl: this.rootStore.session.currentSession?.service || '',
|
serviceUrl: this.rootStore.session.currentSession?.service || '',
|
||||||
})
|
}),
|
||||||
|
]
|
||||||
|
|
||||||
|
// fetch the profiles in chunks of 25 (the limit allowed by `getProfiles`)
|
||||||
|
let profiles: Profile.View[] = []
|
||||||
|
do {
|
||||||
const res = await this.rootStore.api.app.bsky.actor.getProfiles({
|
const res = await this.rootStore.api.app.bsky.actor.getProfiles({
|
||||||
actors: suggestionsList,
|
actors: actors.splice(0, 25),
|
||||||
})
|
})
|
||||||
runInAction(() => {
|
profiles = profiles.concat(res.data.profiles)
|
||||||
this.hardCodedSuggestions = res.data.profiles.filter(
|
} while (actors.length)
|
||||||
profile => !profile.myState?.follow,
|
|
||||||
)
|
runInAction(() => {
|
||||||
})
|
this.hardCodedSuggestions = profiles.filter(
|
||||||
} catch (e) {
|
profile =>
|
||||||
this.rootStore.log.error(
|
!profile.myState?.follow && profile.did !== this.rootStore.me.did,
|
||||||
'Failed to getProfiles() for suggested follows',
|
|
||||||
{e},
|
|
||||||
)
|
)
|
||||||
runInAction(() => {
|
})
|
||||||
this.hardCodedSuggestions = []
|
} catch (e) {
|
||||||
})
|
this.rootStore.log.error(
|
||||||
}
|
'Failed to getProfiles() for suggested follows',
|
||||||
|
{e},
|
||||||
|
)
|
||||||
|
runInAction(() => {
|
||||||
|
this.hardCodedSuggestions = []
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user