ssb: Slight suggested follows cleanup.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m26s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m26s
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🦀",
|
"emoji": "🦀",
|
||||||
"previous": "&ZrdjhiNgjE8U8nlHezw+Hiry43VaNO5i0OAr3ncVVkE=.sha256"
|
"previous": "&DGtlnm5wWRZCgJMF8JsP6VtzNRrd4KLoERJRpFULqOY=.sha256"
|
||||||
}
|
}
|
||||||
|
@@ -156,11 +156,8 @@ class TfTabNewsElement extends LitElement {
|
|||||||
return this.hash.startsWith('##') ? this.hash.substring(2) : undefined;
|
return this.hash.startsWith('##') ? this.hash.substring(2) : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
compare_follows() {
|
compare_follows(a, b) {
|
||||||
const now = new Date().valueOf();
|
return b[1].ts > a[1].ts ? 1 : b[1].ts < a[1].ts ? -1 : 0;
|
||||||
return function (a, b) {
|
|
||||||
return (b[1].ts > now ? -1 : b[1].ts) - (a[1].ts > now ? -1 : a[1].ts);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
suggested_follows() {
|
suggested_follows() {
|
||||||
@@ -169,9 +166,11 @@ class TfTabNewsElement extends LitElement {
|
|||||||
** pinned at the top.
|
** pinned at the top.
|
||||||
*/
|
*/
|
||||||
let self = this;
|
let self = this;
|
||||||
|
let now = new Date().valueOf();
|
||||||
return Object.entries(this.users)
|
return Object.entries(this.users)
|
||||||
|
.filter((x) => x[1].ts < now)
|
||||||
.filter((x) => x[1].follow_depth > 1)
|
.filter((x) => x[1].follow_depth > 1)
|
||||||
.sort(self.compare_follows())
|
.sort(self.compare_follows)
|
||||||
.slice(0, 8)
|
.slice(0, 8)
|
||||||
.map((x) => x[0]);
|
.map((x) => x[0]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user