Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'main' of github.com:bluesky-social/social-app into main

+44 -13
+15 -1
src/state/models/feeds/posts.ts
··· 11 11 import {FeedTuner} from 'lib/api/feed-manip' 12 12 import {PostsFeedSliceModel} from './posts-slice' 13 13 import {track} from 'lib/analytics/analytics' 14 + import {FeedViewPostsSlice} from 'lib/api/feed-manip' 14 15 15 16 const PAGE_SIZE = 30 16 17 18 + type Options = { 19 + /** 20 + * Formats the feed in a flat array with no threading of replies, just 21 + * top-level posts. 22 + */ 23 + isSimpleFeed?: boolean 24 + } 25 + 17 26 type QueryParams = 18 27 | GetTimeline.QueryParams 19 28 | GetAuthorFeed.QueryParams ··· 35 44 pollCursor: string | undefined 36 45 tuner = new FeedTuner() 37 46 pageSize = PAGE_SIZE 47 + options: Options = {} 38 48 39 49 // used to linearize async modifications to state 40 50 lock = new AwaitLock() ··· 49 59 public rootStore: RootStoreModel, 50 60 public feedType: 'home' | 'author' | 'custom', 51 61 params: QueryParams, 62 + options?: Options, 52 63 ) { 53 64 makeAutoObservable( 54 65 this, ··· 60 71 {autoBind: true}, 61 72 ) 62 73 this.params = params 74 + this.options = options || {} 63 75 } 64 76 65 77 get hasContent() { ··· 354 366 this.rootStore.posts.fromFeedItem(item) 355 367 } 356 368 357 - const slices = this.tuner.tune(res.data.feed, this.feedTuners) 369 + const slices = this.options.isSimpleFeed 370 + ? res.data.feed.map(item => new FeedViewPostsSlice([item])) 371 + : this.tuner.tune(res.data.feed, this.feedTuners) 358 372 359 373 const toAppend: PostsFeedSliceModel[] = [] 360 374 for (const slice of slices) {
+12 -5
src/state/models/ui/profile.ts
··· 176 176 filter = 'posts_with_media' 177 177 } 178 178 179 - this.feed = new PostsFeedModel(this.rootStore, 'author', { 180 - actor: this.params.user, 181 - limit: 10, 182 - filter, 183 - }) 179 + this.feed = new PostsFeedModel( 180 + this.rootStore, 181 + 'author', 182 + { 183 + actor: this.params.user, 184 + limit: 10, 185 + filter, 186 + }, 187 + { 188 + isSimpleFeed: ['posts_with_media'].includes(filter), 189 + }, 190 + ) 184 191 185 192 if (this.currentView instanceof PostsFeedModel) { 186 193 this.feed.setup()
+12 -3
src/view/com/post-thread/PostThread.tsx
··· 156 156 }, [navigation]) 157 157 158 158 const renderItem = React.useCallback( 159 - ({item}: {item: YieldedItem}) => { 159 + ({item, index}: {item: YieldedItem; index: number}) => { 160 160 if (item === PARENT_SPINNER) { 161 161 return ( 162 162 <View style={styles.parentSpinner}> ··· 205 205 </View> 206 206 ) 207 207 } else if (item instanceof PostThreadItemModel) { 208 - return <PostThreadItem item={item} onPostReply={onRefresh} /> 208 + const prev = ( 209 + index - 1 >= 0 ? posts[index - 1] : undefined 210 + ) as PostThreadItemModel 211 + return ( 212 + <PostThreadItem 213 + item={item} 214 + onPostReply={onRefresh} 215 + hasPrecedingItem={prev?._showChildReplyLine} 216 + /> 217 + ) 209 218 } 210 219 return <></> 211 220 }, 212 - [onRefresh, onPressReply, pal], 221 + [onRefresh, onPressReply, pal, posts], 213 222 ) 214 223 215 224 // loading
+5 -4
src/view/com/post-thread/PostThreadItem.tsx
··· 38 38 export const PostThreadItem = observer(function PostThreadItem({ 39 39 item, 40 40 onPostReply, 41 + hasPrecedingItem, 41 42 }: { 42 43 item: PostThreadItemModel 43 44 onPostReply: () => void 45 + hasPrecedingItem: boolean 44 46 }) { 45 47 const pal = usePalette('default') 46 48 const store = useStores() ··· 359 361 styles.outer, 360 362 pal.border, 361 363 pal.view, 362 - item._showParentReplyLine && styles.noTopBorder, 363 - !item._showChildReplyLine && {borderBottomWidth: 1}, 364 + item._showParentReplyLine && hasPrecedingItem && styles.noTopBorder, 364 365 ]} 365 366 moderation={item.moderation.content}> 366 367 <PostSandboxWarning /> ··· 483 484 <Link 484 485 style={[ 485 486 styles.loadMore, 486 - {borderBottomColor: pal.colors.border}, 487 + {borderTopColor: pal.colors.border}, 487 488 pal.view, 488 489 ]} 489 490 href={itemHref} ··· 600 601 loadMore: { 601 602 flexDirection: 'row', 602 603 justifyContent: 'space-between', 603 - borderBottomWidth: 1, 604 + borderTopWidth: 1, 604 605 paddingLeft: 80, 605 606 paddingRight: 20, 606 607 paddingVertical: 12,