[newsfeed] Suppress unsightly animation edge cases when there are 0 or 1 active news items (#3336)

When the newsfeed module has an items list of size 1, every
`updateInterval` the animation runs to transition from the active story
to itself. This is unsightly. This PR suppresses that.

To reproduce: configure newsfeed with a single news source,
`ignoreOldItems` true, a short `updateInterval` (e.g. 3000), and a
carefully-chosen small `ignoreOlderThan` lining up with the current
contents of your news source.
This commit is contained in:
Ross Younger
2024-01-14 21:12:32 +13:00
committed by GitHub
parent b47600e0d8
commit dadc7ba0a2
3 changed files with 36 additions and 7 deletions

View File

@@ -5,6 +5,7 @@
* MIT Licensed.
*/
const crypto = require("node:crypto");
const stream = require("node:stream");
const FeedMe = require("feedme");
const iconv = require("iconv-lite");
@@ -67,7 +68,8 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
description: description,
pubdate: pubdate,
url: url,
useCorsProxy: useCorsProxy
useCorsProxy: useCorsProxy,
hash: crypto.createHash("sha256").update(`${pubdate} :: ${title} :: ${url}`).digest("hex")
});
} else if (logFeedWarnings) {
Log.warn("Can't parse feed item:");