Also activate boosts carousel for serial boosts

This commit is contained in:
Lim Chee Aun 2023-01-16 20:50:03 +08:00
parent dc25c52e07
commit 58cefc2853

View file

@ -52,16 +52,22 @@ function Home({ hidden }) {
if (snapStates.settings.boostsCarousel) { if (snapStates.settings.boostsCarousel) {
let specialHome = []; let specialHome = [];
let boostStash = []; let boostStash = [];
let serialBoosts = 0;
for (let i = 0; i < homeValues.length; i++) { for (let i = 0; i < homeValues.length; i++) {
const status = homeValues[i]; const status = homeValues[i];
if (status.reblog) { if (status.reblog) {
boostStash.push(status); boostStash.push(status);
serialBoosts++;
} else { } else {
specialHome.push(status); specialHome.push(status);
if (serialBoosts < 3) {
serialBoosts = 0;
}
} }
} }
// if boostStash is more than quarter of homeValues // if boostStash is more than quarter of homeValues
if (boostStash.length > homeValues.length / 4) { // or if there are 3 or more boosts in a row
if (boostStash.length > homeValues.length / 4 || serialBoosts >= 3) {
// if boostStash is more than 3 quarter of homeValues // if boostStash is more than 3 quarter of homeValues
const boostStashID = boostStash.map((status) => status.id); const boostStashID = boostStash.map((status) => status.id);
if (boostStash.length > (homeValues.length * 3) / 4) { if (boostStash.length > (homeValues.length * 3) / 4) {