ssb: Use most recent post timestamps to feature more relevant people to follow.
This commit is contained in:
@ -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() {
|
||||
|
Reference in New Issue
Block a user