ssb: Unread status for private messages.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m23s

This commit is contained in:
2025-08-14 12:40:58 -04:00
parent d78828554b
commit 00f75d5382
4 changed files with 20 additions and 4 deletions

View File

@@ -116,6 +116,19 @@ class TfTabNewsElement extends LitElement {
) {
return '✉️ ';
}
} else if (channel?.startsWith('🔐')) {
let key = JSON.stringify(channel.substring('🔐'.length).split(','));
if (this.grouped_private_messages?.[key]) {
let grouped_latest = Math.max(
...this.grouped_private_messages?.[key]?.map((x) => x.rowid)
);
if (
this.channels_unread[channel] === undefined ||
grouped_latest > this.channels_unread[channel]
) {
return '✉️ ';
}
}
} else if (
this.channels_latest[channel] &&
this.channels_latest[channel] > 0 &&
@@ -268,7 +281,8 @@ class TfTabNewsElement extends LitElement {
style=${this.hash == '#🔐' + JSON.parse(key).join(',')
? 'font-weight: bold'
: undefined}
>${(key != '[]' ? JSON.parse(key) : [this.whoami]).map(
>${this.unread_status('🔐' + JSON.parse(key).join(','))}
${(key != '[]' ? JSON.parse(key) : [this.whoami]).map(
(id) => html`
<tf-user
id=${id}