diff --git a/apps/ssb.json b/apps/ssb.json index 323314ac..804cc2f3 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&ZrdjhiNgjE8U8nlHezw+Hiry43VaNO5i0OAr3ncVVkE=.sha256" + "previous": "&DGtlnm5wWRZCgJMF8JsP6VtzNRrd4KLoERJRpFULqOY=.sha256" } diff --git a/apps/ssb/tf-tab-news.js b/apps/ssb/tf-tab-news.js index 5c80f0fb..d87b9cb9 100644 --- a/apps/ssb/tf-tab-news.js +++ b/apps/ssb/tf-tab-news.js @@ -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]); }