ssb: Populate reply information in posts.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 21m33s

This commit is contained in:
Cory McWilliams 2024-12-24 13:09:27 -05:00
parent 500f172561
commit 58e9646fa6
2 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&rhBtzGjBcBKINc5qlyopW95SMiPPEP/0GQRDjH6Hsz0=.sha256" "previous": "&QuEaXfdWGAl42dkJBoHocZbtKRT3zT25BNgCo88CSfE=.sha256"
} }

View File

@ -205,6 +205,18 @@ class TfComposeElement extends LitElement {
message.root = this.new_thread ? this.branch ?? this.root : this.root; message.root = this.new_thread ? this.branch ?? this.root : this.root;
message.branch = this.branch; message.branch = this.branch;
} }
let reply = Object.fromEntries((await tfrpc.rpc.query(
`
SELECT messages.id, messages.author FROM messages
JOIN json_each(?) AS refs ON messages.id = refs.value
`,
[JSON.stringify([this.root, this.branch])])).map(row => [
row.id,
row.author,
]));
if (Object.keys(reply).length) {
message.reply = reply;
}
if (Object.values(draft.mentions || {}).length) { if (Object.values(draft.mentions || {}).length) {
message.mentions = Object.values(draft.mentions); message.mentions = Object.values(draft.mentions);
} }