summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-17 23:14:46 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-17 23:14:46 +0200
commite412581e04a2c9b33f5cdc019b44bc7cd2158180 (patch)
tree70e01405ae5920a4b87276fde2fe04176b08c9dd /packages
parent84946b1fef64ee619f1c161d57ef4afdc533eae2 (diff)
downloadmeshbay-e412581e04a2c9b33f5cdc019b44bc7cd2158180.tar.gz
feat(spa): purging the chat asks first
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/chat-app-settings.js6
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/de.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/en.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/es.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/it.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js1
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js1
-rw-r--r--packages/meshbay-hub/tests/test_app_settings_plugin.py12
12 files changed, 27 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/chat-app-settings.js b/packages/meshbay-hub/src/meshbay_hub/static/chat-app-settings.js
index 892c3324..4a38b074 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/chat-app-settings.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/chat-app-settings.js
@@ -2,6 +2,7 @@ import { html, useState, useEffect } from './vendor/htm-preact.js';
import { t } from './i18n.js';
import { ToggleSwitch, useSaver } from './settings-ui.js';
import { FolderPickerField } from './folder-tree.js';
+import { ask } from './ask.js';
/**
* Chat's operator settings.
@@ -75,7 +76,10 @@ function ChatSettings({ roots, dirs, settings, saveDirectories, transport,
</div>
<div class="settings-row" style="margin-top:12px">
<button class="app-save" disabled=${busy}
- onClick=${() => run(() => transport.purgeChat(signFn))}>
+ onClick=${async () => {
+ if (!(await ask(t('settings_app.chat_purge_confirm')))) return;
+ run(() => transport.purgeChat(signFn));
+ }}>
${busy ? t('settings_app.saving') : t('settings_app.chat_purge')}
</button>
<p class="settings-hint">${t('settings_app.chat_purge_hint')}</p>
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js
index 228402c9..0e042527 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js
@@ -1134,6 +1134,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'Mitglieder lesen weiterhin den gesamten Verlauf. Wer aus der Gruppe entfernt wurde, kann nicht mehr lesen, was ab jetzt geschrieben wird. Ein Mitglied oder Gerät zu entfernen tut das bereits von selbst.',
'settings_app.chat_purge': 'Chat leeren',
'settings_app.chat_purge_hint': 'Löscht alle Nachrichten im Chat dieser Gruppe auf diesem Knoten, für alle Mitglieder. Anhänge bleiben in ihrem Ordner. Das lässt sich nicht rückgängig machen.',
+ 'settings_app.chat_purge_confirm': 'Alle Nachrichten des Chats für alle Mitglieder löschen? Das lässt sich nicht rückgängig machen.',
'settings_app.tmdb_token_prompt': 'Registrieren Sie sich bei TMDB, um einen eigenen API-Schlüssel zu erzeugen.',
'settings_app.tmdb_token_link': 'Schlüssel holen',
'settings_node.roots_offline_hint': 'Nicht mit dem Node verbunden — Änderungen laufen über den lokalen Node und greifen beim nächsten Neuladen.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js
index 40c20244..15ea05d4 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js
@@ -818,6 +818,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'Members keep reading the whole history. Anyone removed from the group cannot read what is written from now on. Removing a member or a device already does this by itself.',
'settings_app.chat_purge': 'Purge the chat',
'settings_app.chat_purge_hint': 'Deletes every message in this group\'s chat on this node, for every member. Attachments stay in their folder. This cannot be undone.',
+ 'settings_app.chat_purge_confirm': 'Purge every message in the chat, for every member? This cannot be undone.',
'settings_app.tmdb_token_prompt': 'Sign up on TMDB to generate your own API key.',
'settings_app.tmdb_token_link': 'Get a key',
'settings_node.roots_offline_hint': 'Not connected to the node — changes go through the local node instead, and take effect on its next reload.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js
index 643fdeab..7dea659a 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js
@@ -1129,6 +1129,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'Los miembros siguen leyendo todo el historial. Quien haya sido expulsado del grupo no podrá leer lo que se escriba a partir de ahora. Quitar a un miembro o un dispositivo ya lo hace por sí solo.',
'settings_app.chat_purge': 'Vaciar el chat',
'settings_app.chat_purge_hint': 'Borra todos los mensajes del chat de este grupo en este nodo, para todos los miembros. Los adjuntos se quedan en su carpeta. No se puede deshacer.',
+ 'settings_app.chat_purge_confirm': '¿Purgar todos los mensajes del chat, para todos los miembros? No se puede deshacer.',
'settings_app.tmdb_token_prompt': 'Regístrate en TMDB para generar tu propia clave de API.',
'settings_app.tmdb_token_link': 'Obtener una clave',
'settings_node.roots_offline_hint': 'Sin conexión con el nodo: los cambios pasan por el nodo local y se aplican en su próxima recarga.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js
index 8df543e4..fbf22165 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js
@@ -1147,6 +1147,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'Les membres continuent de lire tout l\'historique. Quiconque a été retiré du groupe ne peut plus lire ce qui sera écrit. Retirer un membre ou un appareil le fait déjà tout seul.',
'settings_app.chat_purge': 'Purger la discussion',
'settings_app.chat_purge_hint': 'Supprime tous les messages de la discussion de ce groupe sur ce nœud, pour tous les membres. Les pièces jointes restent dans leur dossier. C\'est irréversible.',
+ 'settings_app.chat_purge_confirm': 'Purger tous les messages de la discussion, pour tous les membres ? C\'est irréversible.',
'settings_app.tmdb_token_prompt': 'Créez un compte TMDB pour générer votre propre clé d\'API.',
'settings_app.tmdb_token_link': 'Obtenir une clé',
'settings_node.roots_offline_hint': 'Non connecté au nœud — les changements passent par le nœud local et prennent effet à son prochain rechargement.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js
index 8912af69..07c26368 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js
@@ -1143,6 +1143,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'I membri continuano a leggere tutta la cronologia. Chi è stato rimosso dal gruppo non potrà leggere ciò che verrà scritto d\'ora in poi. Rimuovere un membro o un dispositivo lo fa già da solo.',
'settings_app.chat_purge': 'Svuota la chat',
'settings_app.chat_purge_hint': 'Elimina tutti i messaggi della chat di questo gruppo su questo nodo, per tutti i membri. Gli allegati restano nella loro cartella. Non si può annullare.',
+ 'settings_app.chat_purge_confirm': 'Eliminare tutti i messaggi della chat, per tutti i membri? L\'operazione è irreversibile.',
'settings_app.tmdb_token_prompt': 'Registrati su TMDB per generare la tua chiave API.',
'settings_app.tmdb_token_link': 'Ottieni una chiave',
'settings_node.roots_offline_hint': 'Non connesso al nodo: le modifiche passano dal nodo locale e hanno effetto al successivo ricaricamento.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js
index 01a84dc9..34f26196 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js
@@ -1127,6 +1127,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'メンバーは履歴全体を引き続き読めます。グループから外された相手は、これ以降に書かれた内容を読めません。メンバーや端末を削除すると、これは自動的に行われます。',
'settings_app.chat_purge': 'チャットを消去する',
'settings_app.chat_purge_hint': 'このノードに保存されたこのグループのチャットのメッセージを、全メンバー分すべて削除します。添付ファイルはフォルダーに残ります。元に戻せません。',
+ 'settings_app.chat_purge_confirm': 'チャットのすべてのメッセージを全メンバー分削除しますか?元に戻せません。',
'settings_app.tmdb_token_prompt': 'TMDB に登録して、自分の API キーを発行してください。',
'settings_app.tmdb_token_link': 'キーを取得',
'settings_node.roots_offline_hint': 'ノードに接続していません — 変更はローカルノード経由で行われ、次回の再読み込みで反映されます。',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js
index dec9e9f5..482dfe59 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js
@@ -1145,6 +1145,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'Leden blijven de hele geschiedenis lezen. Wie uit de groep is verwijderd, kan niet lezen wat er vanaf nu wordt geschreven. Een lid of apparaat verwijderen doet dit al vanzelf.',
'settings_app.chat_purge': 'Chat leegmaken',
'settings_app.chat_purge_hint': 'Verwijdert alle berichten in de chat van deze groep op deze node, voor alle leden. Bijlagen blijven in hun map. Dit kan niet ongedaan worden gemaakt.',
+ 'settings_app.chat_purge_confirm': 'Alle berichten in de chat wissen, voor alle leden? Dit kan niet ongedaan worden gemaakt.',
'settings_app.tmdb_token_prompt': 'Meld u aan bij TMDB om uw eigen API-sleutel te maken.',
'settings_app.tmdb_token_link': 'Sleutel ophalen',
'settings_node.roots_offline_hint': 'Niet verbonden met de node — wijzigingen gaan via de lokale node en worden bij de volgende herlaadbeurt actief.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js
index 0de71416..4480b7d6 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js
@@ -1173,6 +1173,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'Członkowie nadal czytają całą historię. Osoba usunięta z grupy nie odczyta tego, co zostanie napisane od teraz. Usunięcie członka lub urządzenia robi to już samo.',
'settings_app.chat_purge': 'Wyczyść czat',
'settings_app.chat_purge_hint': 'Usuwa wszystkie wiadomości czatu tej grupy na tym węźle, dla wszystkich członków. Załączniki zostają w swoim folderze. Tego nie można cofnąć.',
+ 'settings_app.chat_purge_confirm': 'Usunąć wszystkie wiadomości czatu dla wszystkich członków? Tego nie można cofnąć.',
'settings_app.tmdb_token_prompt': 'Zarejestruj się w TMDB, aby wygenerować własny klucz API.',
'settings_app.tmdb_token_link': 'Pobierz klucz',
'settings_node.roots_offline_hint': 'Brak połączenia z węzłem — zmiany przechodzą przez węzeł lokalny i zaczną działać po jego następnym przeładowaniu.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js
index 89e854c1..b9e89ccf 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js
@@ -1130,6 +1130,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': 'Os membros continuam lendo todo o histórico. Quem foi removido do grupo não conseguirá ler o que for escrito daqui em diante. Remover um membro ou dispositivo já faz isso sozinho.',
'settings_app.chat_purge': 'Limpar o chat',
'settings_app.chat_purge_hint': 'Apaga todas as mensagens do chat deste grupo neste nó, para todos os membros. Os anexos ficam na pasta deles. Não é possível desfazer.',
+ 'settings_app.chat_purge_confirm': 'Apagar todas as mensagens do chat, para todos os membros? Isso não pode ser desfeito.',
'settings_app.tmdb_token_prompt': 'Cadastre-se no TMDB para gerar sua própria chave de API.',
'settings_app.tmdb_token_link': 'Obter uma chave',
'settings_node.roots_offline_hint': 'Sem conexão com o nó — as alterações passam pelo nó local e entram em vigor no próximo recarregamento.',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js
index 08bf5593..00524749 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js
@@ -1115,6 +1115,7 @@ export default {
'settings_app.chat_rotate_epoch_hint': '成员仍可阅读全部历史记录。已被移出群组的人无法阅读此后写入的内容。移除成员或设备时已自动执行此操作。',
'settings_app.chat_purge': '清空聊天',
'settings_app.chat_purge_hint': '删除此节点上该群组聊天的全部消息,对所有成员生效。附件保留在其文件夹中。此操作无法撤销。',
+ 'settings_app.chat_purge_confirm': '为所有成员清除聊天中的全部消息?此操作无法撤销。',
'settings_app.tmdb_token_prompt': '在 TMDB 注册以生成你自己的 API 密钥。',
'settings_app.tmdb_token_link': '获取密钥',
'settings_node.roots_offline_hint': '未连接到节点 — 变更将通过本地节点进行,并在其下次重新加载时生效。',
diff --git a/packages/meshbay-hub/tests/test_app_settings_plugin.py b/packages/meshbay-hub/tests/test_app_settings_plugin.py
index d469d8a4..3d11c9ef 100644
--- a/packages/meshbay-hub/tests/test_app_settings_plugin.py
+++ b/packages/meshbay-hub/tests/test_app_settings_plugin.py
@@ -174,6 +174,18 @@ def test_a_read_only_root_cannot_be_chosen_as_a_destination():
"Chat's directory picker does not require a writable root")
+def test_purging_the_chat_asks_first():
+ """
+ A purge deletes every message for every member and cannot be undone: the
+ button asks before sending the operation, never after.
+ """
+ chat = (STATIC / "chat-app-settings.js").read_text(encoding="utf-8")
+ asked = chat.index("ask(t('settings_app.chat_purge_confirm'))")
+ sent = chat.index("transport.purgeChat(signFn)")
+ assert asked < sent, "the purge is sent before the confirmation"
+ assert "if (!(await ask(t('settings_app.chat_purge_confirm')))) return;" in chat
+
+
def test_the_picker_can_clear_a_selection():
"""
Confirming with nothing chosen is how an app's directories are unset, and