ssb: Use most recent post timestamps to feature more relevant people to follow.

This commit is contained in:
2025-01-14 20:15:18 -05:00
parent e198ff9cb1
commit db0a4bff77
4 changed files with 51 additions and 32 deletions

View File

@ -128,21 +128,24 @@ class TfTabNewsElement extends LitElement {
return this.hash.startsWith('##') ? this.hash.substring(2) : undefined;
}
compare_follows(a, b) {
return a[1].followed - b[1].followed;
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);
};
}
suggested_follows() {
/*
** Filter out people who have used future timestamps so that they aren't
** pinned at the top.
*/
let self = this;
return Object.entries(this.users).filter(
(x) => (x[1].follow_depth > 1)
).sort(
self.compare_follows
).slice(
0, 8
).map(
(x) => (x[0])
);
return Object.entries(this.users)
.filter((x) => x[1].follow_depth > 1)
.sort(self.compare_follows())
.slice(0, 8)
.map((x) => x[0]);
}
render_sidebar() {