diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-24 18:49:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-24 18:49:11 -0500 |
commit | df1791bde2dd2ddd22ad5050584cec94fe3a8ccb (patch) | |
tree | 83b5fc21a6d81e07f74dae035ae3f93029976a7c /src | |
parent | c5222db38b4520d495d942ae0b6e57d631b40d7b (diff) | |
download | voidsky-df1791bde2dd2ddd22ad5050584cec94fe3a8ccb.tar.zst |
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 system
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/constants.ts | 149 | ||||
-rw-r--r-- | src/state/models/discovery/suggested-actors.ts | 83 |
2 files changed, 46 insertions, 186 deletions
diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 07d6e133b..df325b059 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -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`, ) diff --git a/src/state/models/discovery/suggested-actors.ts b/src/state/models/discovery/suggested-actors.ts index dca81dc90..dc9cac817 100644 --- a/src/state/models/discovery/suggested-actors.ts +++ b/src/state/models/discovery/suggested-actors.ts @@ -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,77 +57,25 @@ 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 = [ ...SUGGESTED_FOLLOWS( 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 // = |