diff options
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.js | 15 |
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 |