From 5115c6e21707071599d3381a52372419c6870143 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 10 Dec 2024 21:09:55 -0500 Subject: [PATCH] ssb: Fix an instance of channels being stuck unread. --- apps/ssb.json | 2 +- apps/ssb/tf-message.js | 4 ++-- apps/ssb/tf-news.js | 2 ++ apps/ssb/tf-tab-news-feed.js | 4 +++- apps/ssb/tf-tab-news.js | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index f27e6291..1ac1d7cf 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&UuIvaWISWWRqgpN5ccS32C71334ofLV+qMcaDDqUn28=.sha256" + "previous": "&hWgKPOx3M3T7BufeywObcOCHvsdRfVAoZ9LErkPhJPE=.sha256" } diff --git a/apps/ssb/tf-message.js b/apps/ssb/tf-message.js index 12d30cad..0ca346db 100644 --- a/apps/ssb/tf-message.js +++ b/apps/ssb/tf-message.js @@ -443,8 +443,8 @@ ${JSON.stringify(mention, null, 2)} ` )} diff --git a/apps/ssb/tf-news.js b/apps/ssb/tf-news.js index a99024d8..4c230136 100644 --- a/apps/ssb/tf-news.js +++ b/apps/ssb/tf-news.js @@ -165,6 +165,7 @@ class TfNewsElement extends LitElement { } else { if (group.length > 0) { result.push({ + rowid: Math.max(...group.map(x => x.rowid)), type: 'contact_group', messages: group, }); @@ -175,6 +176,7 @@ class TfNewsElement extends LitElement { } if (group.length > 0) { result.push({ + rowid: Math.max(...group.map(x => x.rowid)), type: 'contact_group', messages: group, }); diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js index b8b9a5a7..aa061218 100644 --- a/apps/ssb/tf-tab-news-feed.js +++ b/apps/ssb/tf-tab-news-feed.js @@ -13,6 +13,7 @@ class TfTabNewsFeedElement extends LitElement { drafts: {type: Object}, expanded: {type: Object}, channels_unread: {type: Object}, + channels_latest: {type: Object}, loading: {type: Number}, time_range: {type: Array}, time_loading: {type: Array}, @@ -31,6 +32,7 @@ class TfTabNewsFeedElement extends LitElement { this.drafts = {}; this.expanded = {}; this.channels_unread = {}; + this.channels_latest = {}; this.start_time = new Date().valueOf(); this.time_range = [0, 0]; this.time_loading = undefined; @@ -320,7 +322,7 @@ class TfTabNewsFeedElement extends LitElement { mark_all_read() { let newest = this.messages.reduce( (accumulator, current) => Math.max(accumulator, current.rowid), - -1 + this.channels_latest[this.channel()] ?? -1 ); if (newest >= 0) { this.dispatchEvent( diff --git a/apps/ssb/tf-tab-news.js b/apps/ssb/tf-tab-news.js index 5b4fb220..c7f7ce78 100644 --- a/apps/ssb/tf-tab-news.js +++ b/apps/ssb/tf-tab-news.js @@ -277,6 +277,7 @@ class TfTabNewsElement extends LitElement { @tf-draft=${this.draft} @tf-expand=${this.on_expand} .channels_unread=${this.channels_unread} + .channels_latest=${this.channels_latest} > `;