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

@@ -374,7 +374,7 @@ class TfElement extends LitElement {
let result = await this.decrypt(
await tfrpc.rpc.query(
`
SELECT messages.id, author, timestamp, json(content) AS content
SELECT messages.rowid, messages.id, author, timestamp, json(content) AS content
FROM messages
JOIN json_each(?) AS ids
WHERE messages.id = ids.value

View File

@@ -92,7 +92,9 @@ class TfComposeElement extends LitElement {
bubbles: true,
composed: true,
detail: {
id: this.branch ?? (this.recipients ? this.recipients.join(',') : undefined),
id:
this.branch ??
(this.recipients ? this.recipients.join(',') : undefined),
draft: draft,
},
})

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}