Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Dont apply the content-language filter if it will remove all content (#3492)

* Dont apply the content-language filter if it will remove all content

* Improve code

authored by

Paul Frazee and committed by
GitHub
ed2c8b72 ad97d435

+15 -5
+15 -5
src/lib/api/feed-manip.ts
··· 1 1 import { 2 + AppBskyEmbedRecord, 3 + AppBskyEmbedRecordWithMedia, 2 4 AppBskyFeedDefs, 3 5 AppBskyFeedPost, 4 - AppBskyEmbedRecordWithMedia, 5 - AppBskyEmbedRecord, 6 6 } from '@atproto/api' 7 + 8 + import {isPostInLanguage} from '../../locale/helpers' 7 9 import {ReasonFeedSource} from './feed/types' 8 - import {isPostInLanguage} from '../../locale/helpers' 9 10 type FeedViewPost = AppBskyFeedDefs.FeedViewPost 10 11 11 12 export type FeedTunerFn = ( ··· 341 342 tuner: FeedTuner, 342 343 slices: FeedViewPostsSlice[], 343 344 ): FeedViewPostsSlice[] => { 345 + const candidateSlices = slices.slice() 346 + 344 347 // early return if no languages have been specified 345 348 if (!preferredLangsCode2.length || preferredLangsCode2.length === 0) { 346 349 return slices ··· 357 360 358 361 // if item does not fit preferred language, remove it 359 362 if (!hasPreferredLang) { 360 - slices.splice(i, 1) 363 + candidateSlices.splice(i, 1) 361 364 } 362 365 } 363 - return slices 366 + 367 + // if the language filter cleared out the entire page, return the original set 368 + // so that something always shows 369 + if (candidateSlices.length === 0) { 370 + return slices 371 + } 372 + 373 + return candidateSlices 364 374 } 365 375 } 366 376 }