ssb: Slight suggested follows cleanup.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m26s

This commit is contained in:
2025-07-16 21:01:24 -04:00
parent 05e54e1be0
commit 638b7cc1e5
2 changed files with 6 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "🦀",
"previous": "&ZrdjhiNgjE8U8nlHezw+Hiry43VaNO5i0OAr3ncVVkE=.sha256"
"previous": "&DGtlnm5wWRZCgJMF8JsP6VtzNRrd4KLoERJRpFULqOY=.sha256"
}

View File

@@ -156,11 +156,8 @@ class TfTabNewsElement extends LitElement {
return this.hash.startsWith('##') ? this.hash.substring(2) : undefined;
}
compare_follows() {
const now = new Date().valueOf();
return function (a, b) {
return (b[1].ts > now ? -1 : b[1].ts) - (a[1].ts > now ? -1 : a[1].ts);
};
compare_follows(a, b) {
return b[1].ts > a[1].ts ? 1 : b[1].ts < a[1].ts ? -1 : 0;
}
suggested_follows() {
@@ -169,9 +166,11 @@ class TfTabNewsElement extends LitElement {
** pinned at the top.
*/
let self = this;
let now = new Date().valueOf();
return Object.entries(this.users)
.filter((x) => x[1].ts < now)
.filter((x) => x[1].follow_depth > 1)
.sort(self.compare_follows())
.sort(self.compare_follows)
.slice(0, 8)
.map((x) => x[0]);
}