From 58e9646fa6969f4b3f47286a4b8ce698f34439e5 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 24 Dec 2024 13:09:27 -0500 Subject: [PATCH] ssb: Populate reply information in posts. --- apps/ssb.json | 2 +- apps/ssb/tf-compose.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/ssb.json b/apps/ssb.json index 05fadbf0..0e6055dd 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&rhBtzGjBcBKINc5qlyopW95SMiPPEP/0GQRDjH6Hsz0=.sha256" + "previous": "&QuEaXfdWGAl42dkJBoHocZbtKRT3zT25BNgCo88CSfE=.sha256" } diff --git a/apps/ssb/tf-compose.js b/apps/ssb/tf-compose.js index c7d807d4..0f583182 100644 --- a/apps/ssb/tf-compose.js +++ b/apps/ssb/tf-compose.js @@ -205,6 +205,18 @@ class TfComposeElement extends LitElement { message.root = this.new_thread ? this.branch ?? this.root : this.root; 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) { message.mentions = Object.values(draft.mentions); }