[APP-549] Language controls for Whats Hot (#563)
* Add a content-language preference control * Update whats hot to only show the selected languages and to refresh on lang pref changes * Fix lint * Fix tests * Add missing accessibility role
This commit is contained in:
parent
95f8360d19
commit
6f1c4ec9a9
14 changed files with 381 additions and 93 deletions
|
@ -202,7 +202,9 @@ export class FeedTuner {
|
|||
tuner: FeedTuner,
|
||||
slices: FeedViewPostsSlice[],
|
||||
): FeedViewPostsSlice[] => {
|
||||
const origSlices = slices.concat()
|
||||
if (!langsCode2.length) {
|
||||
return slices
|
||||
}
|
||||
for (let i = slices.length - 1; i >= 0; i--) {
|
||||
let hasPreferredLang = false
|
||||
for (const item of slices[i].items) {
|
||||
|
@ -236,11 +238,7 @@ export class FeedTuner {
|
|||
slices.splice(i, 1)
|
||||
}
|
||||
}
|
||||
if (slices.length) {
|
||||
return slices
|
||||
}
|
||||
// fallback: give everything if the language filter left nothing
|
||||
return origSlices
|
||||
return slices
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue