diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-09 12:16:51 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-09 12:17:38 +0200 |
| commit | 4ae61dc4e1dcca6ae24131fcd9acc55124e3c0af (patch) | |
| tree | 44fd15f6175ade9b0b884f846dfd9d66e2b3bc80 /packages/meshbay-node/src/meshbay_node/ops/chat.py | |
| parent | 6832df6177ad973ad0e1b4f0a49d7a6da06c6e04 (diff) | |
| download | meshbay-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-node/src/meshbay_node/ops/chat.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/ops/chat.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops/chat.py b/packages/meshbay-node/src/meshbay_node/ops/chat.py index 539284b..9fc7b94 100644 --- a/packages/meshbay-node/src/meshbay_node/ops/chat.py +++ b/packages/meshbay-node/src/meshbay_node/ops/chat.py @@ -252,3 +252,22 @@ async def prune_chat(state: dict, group_id: str, max_age_days: int) -> dict: group_id[:8], removed) return {"group_id": group_id, "removed": removed, "max_age_days": max_age_days} + + +async def purge_chat(state: dict, group_id: str) -> dict: + """ + Delete every stored message of the group. Epoch keys are kept, as in + `prune_chat`, and attachments too: they are files in a shared folder. + + The replay index goes with the rows, which is harmless: the node takes a + sealed message only from the device that signed it, so the one party able + to send a purged message again is its author. + """ + ctx = _group_ctx(state, group_id) + store = ctx.get("chat_store") + if store is None: + raise OpError("This group has no chat store", status=404) + removed = await store.delete_all() + log.info("Chat purged for group %s: %d message(s) removed", + group_id[:8], removed) + return {"group_id": group_id, "removed": removed} |