forked from cory/tildefriends
ssb: Fix issues with private messages to one's self.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🦀",
|
"emoji": "🦀",
|
||||||
"previous": "&A1H5/wFzj8lTt2HBBb8Gj6tQnx+c2y0LvJnDvZqy10Y=.sha256"
|
"previous": "&dG2winiXQktKgYn8MEX+K7HUtY7PfYh1a9L9IVdCrtM=.sha256"
|
||||||
}
|
}
|
||||||
|
@@ -385,7 +385,7 @@ class TfElement extends LitElement {
|
|||||||
);
|
);
|
||||||
for (let message of result) {
|
for (let message of result) {
|
||||||
let key = JSON.stringify(
|
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]) {
|
if (!groups[key]) {
|
||||||
groups[key] = [];
|
groups[key] = [];
|
||||||
|
@@ -209,27 +209,8 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
console.log(
|
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}`
|
`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('#🔐')) {
|
} 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(
|
result = await tfrpc.rpc.query(
|
||||||
`
|
`
|
||||||
SELECT TRUE AS is_primary, messages.rowid, messages.id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
|
SELECT TRUE AS is_primary, messages.rowid, messages.id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
|
||||||
|
Reference in New Issue
Block a user