aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-09 12:16:51 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-09 12:17:38 +0200
commit4ae61dc4e1dcca6ae24131fcd9acc55124e3c0af (patch)
tree44fd15f6175ade9b0b884f846dfd9d66e2b3bc80 /packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
parent6832df6177ad973ad0e1b4f0a49d7a6da06c6e04 (diff)
downloadmeshbay-4ae61dc4e1dcca6ae24131fcd9acc55124e3c0af.tar.gz
feat: let the operator purge a group's chat (MNP 6.1)
Signed chat_purge from the Chat settings deletes every stored message; epoch keys and attachments stay. The ack is broadcast so open chat panels empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
index 96e06d7..9ce07bc 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
@@ -78,6 +78,21 @@ extendTransport(class {
}
/**
+ * Delete every stored message of this group's chat. Operator only, and
+ * signed; the subject is the group id. The node broadcasts `chat_purge_ack`,
+ * which empties every open chat panel, this one included.
+ */
+ async purgeChat(signFn) {
+ const groupId = this._groupId || '';
+ const msg = await this._sendAndWait({ type: 'chat_purge', v: '6.1' });
+ if (msg.type === 'error') throw new Error(msg.detail);
+ if (msg.type === 'admin_challenge') {
+ return this._authorizeAdminOp(msg, 'chat_purge', groupId, signFn);
+ }
+ return msg;
+ }
+
+ /**
* A page of chat history, newest first by default.
*
* `before` is a message id, not a timestamp: it pages backwards from the