diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/transport.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport.js b/packages/meshbay-hub/src/meshbay_hub/static/transport.js index fa5d28b..e995ffe 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/transport.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/transport.js @@ -197,7 +197,7 @@ function _aborted() { const BROADCAST_ACK_TYPES = new Set([ 'root_eject_ack', 'root_plug_ack', 'root_remove_ack', 'app_directories_ack', 'chat_directory_ack', 'chat_link_preview_ack', - 'chat_epoch_ack', 'search_listed_ack', + 'chat_epoch_ack', 'chat_purge_ack', 'search_listed_ack', ]); /** Hand a broadcast ack to the callback that would have had it from a peer. */ @@ -212,6 +212,8 @@ function _replayBroadcast(transport, msg) { transport._onSearchListed(msg.listed !== false); } else if (msg.type === 'chat_epoch_ack') { transport._applyChatEpoch(msg); + } else if (msg.type === 'chat_purge_ack') { + if (transport._onChatPurged) transport._onChatPurged(); } else if (transport._onRootsChanged) { transport._onRootsChanged(msg); } @@ -223,7 +225,7 @@ const ADMIN_OP_TYPES = new Set([ 'apps_enabled', 'set_scan_settings', 'member_revoke', 'root_remove', 'root_eject', 'root_plug', 'app_directories', 'chat_directory', 'chat_link_preview', 'chat_epoch', - 'search_listed', 'invite_create', 'invite_link_create', 'invite_cancel', + 'chat_purge', 'search_listed', 'invite_create', 'invite_link_create', 'invite_cancel', ]); // ── Diagnostic trace (opt-in, off by default) ─────────────────────────────── @@ -545,6 +547,7 @@ class MeshBayTransport { this._recvBuf = new Uint8Array(0); this._connected = false; this._onChat = null; + this._onChatPurged = null; this._onStreamInit = null; this._onStreamData = null; this._onStreamEnd = null; @@ -625,6 +628,7 @@ class MeshBayTransport { get reconnecting() { return !!this._reconnectPromise; } set onChat(fn) { this._onChat = fn; } + set onChatPurged(fn) { this._onChatPurged = fn; } set onStreamInit(fn) { this._onStreamInit = fn; } set onStreamData(fn) { this._onStreamData = fn; } set onStreamEnd(fn) { this._onStreamEnd = fn; } @@ -1996,6 +2000,11 @@ class MeshBayTransport { this._applyChatEpoch(msg); return; } + // The operator purged the group's chat: every open panel empties. + if (msg.type === 'chat_purge_ack') { + if (this._onChatPurged) this._onChatPurged(); + return; + } // Node-wide (not per-group) — the operator supplied/cleared a custom // token, or changed the query language. `token_customized` only says |