ssb: Fix issues with private messages to one's self.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled

This commit is contained in:
2025-08-13 20:12:27 -04:00
parent e1f3dc6ae4
commit a618815500
3 changed files with 3 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "🦀",
"previous": "&A1H5/wFzj8lTt2HBBb8Gj6tQnx+c2y0LvJnDvZqy10Y=.sha256"
"previous": "&dG2winiXQktKgYn8MEX+K7HUtY7PfYh1a9L9IVdCrtM=.sha256"
}

View File

@@ -385,7 +385,7 @@ class TfElement extends LitElement {
);
for (let message of result) {
let key = JSON.stringify(
message?.decrypted?.recps?.filter((x) => x != this.whoami)?.sort()
message?.decrypted?.recps?.filter((x) => x != this.whoami)?.sort() ?? []
);
if (!groups[key]) {
groups[key] = [];

View File

@@ -209,27 +209,8 @@ class TfTabNewsFeedElement extends LitElement {
console.log(
`load of ${result.length} rows took ${(t2 - t0) / 1000} (${(t1 - t0) / 1000} to find ${initial_messages.length} initial messages, ${(t2 - t1) / 1000} to find ${result.length} total messages) following=${this.following.length} st=${start_time} et=${end_time}`
);
} else if (this.hash == '#🔐') {
result = await tfrpc.rpc.query(
`
SELECT TRUE AS is_primary, messages.rowid, messages.id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
FROM messages
JOIN json_each(?1) AS private_messages ON messages.id = private_messages.value
WHERE
(?2 IS NULL OR (messages.timestamp >= ?2)) AND messages.timestamp < ?3 AND
json(messages.content) LIKE '"%'
ORDER BY messages.rowid DESC LIMIT ?4
`,
[
JSON.stringify(this.private_messages),
start_time,
end_time,
k_max_results,
]
);
result = (await this.decrypt(result)).filter((x) => x.decrypted);
} else if (this.hash.startsWith('#🔐')) {
let ids = this.hash.substring('#🔐'.length).split(',');
let ids = this.hash == '#🔐' ? [] : this.hash.substring('#🔐'.length).split(',');
result = await tfrpc.rpc.query(
`
SELECT TRUE AS is_primary, messages.rowid, messages.id, previous, author, sequence, timestamp, hash, json(content) AS content, signature