Getting trolled by my own code

This commit is contained in:
Lim Chee Aun 2023-01-27 14:36:47 +08:00
parent 77c1b36a1f
commit 515b988b94

View file

@ -429,10 +429,10 @@ function startVisibility() {
console.log('visible', { lastHidden, diffMins }); console.log('visible', { lastHidden, diffMins });
(async () => { (async () => {
try { try {
const firstStatusID = states.home[0]?.id; const firstStatusID = states.homeLast?.id;
const firstNotificationID = states.notifications[0]?.id; const firstNotificationID = states.notificationsLast?.id;
const fetchHome = masto.v1.timelines.listHome({ const fetchHome = masto.v1.timelines.listHome({
limit: 1, limit: 5,
...(firstStatusID && { sinceId: firstStatusID }), ...(firstStatusID && { sinceId: firstStatusID }),
}); });
const fetchNotifications = masto.v1.notifications.list({ const fetchNotifications = masto.v1.notifications.list({
@ -441,10 +441,10 @@ function startVisibility() {
}); });
const newStatuses = await fetchHome; const newStatuses = await fetchHome;
const newStatus = newStatuses?.[0]; const hasOneAndReblog =
const inHome = newStatus?.id !== states.homeLast?.id; newStatuses.length === 1 && newStatuses?.[0]?.reblog;
if (newStatuses.length && !inHome) { if (newStatuses.length && !inHome) {
if (states.settings.boostsCarousel && newStatus.reblog) { if (states.settings.boostsCarousel && hasOneAndReblog) {
// do nothing // do nothing
} else { } else {
states.homeNew = newStatuses.map((status) => { states.homeNew = newStatuses.map((status) => {