diff --git a/CHANGELOG.md b/CHANGELOG.md index bcfdd28f..7f5f5e76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.4] - 2026-10-27 - Fix: Version 1.0.3 could archive active one-to-one and private conversations on its own. This no longer happens. If 1.0.3 archived some of your chats, open your archived conversations and un-archive them; nothing in them was lost. +- Fix: In some group chats, every message from a particular member was invisible to everyone, that member included — their messages seemed to vanish right after sending. The messages were delivered all along and now show. Members whose name the chat does not know yet appear as "Unknown member", and the app now repairs your own entry in any chat where it was missing. - Feat: The app now tells you when a new version is available. On Windows, macOS and the Linux AppImage you can install it from inside the app; on Android it opens F-Droid, and on Ubuntu Touch the OpenStore. - Feat: Your message history and the images in your conversations, archived ones included, are now saved too, so they can come with you into the next major update. This happens automatically in the background and only adds new messages and images after the first run. - Fix: The saved copy of your account is now readable only by your own user on Linux and macOS. diff --git a/tests/src/relay/relay/profile.test.ts b/tests/src/relay/relay/profile.test.ts new file mode 100644 index 00000000..82c4beec --- /dev/null +++ b/tests/src/relay/relay/profile.test.ts @@ -0,0 +1,60 @@ +import { assert, test } from "vitest"; + +import { runScenario } from '@holochain/tryorama'; +import { Record } from '@holochain/client'; + +const testAppPath = process.cwd() + '/../workdir/relay.happ'; +const appSource = { appBundleSource: { type: "path", value: testAppPath } }; + +// The app repairs a conversation that is missing your profile by checking for +// it with a local-only lookup and writing it when absent +// (ProfileStore.repairMyConversationProfiles). create_profile does not refuse a +// second profile, so that lookup must find a profile you wrote yourself, with +// no network at all — otherwise every launch would add another one. +test('own profile is found by a local-only lookup, and a missing one is reported as missing', async () => { + await runScenario(async scenario => { + const [alice] = await scenario.addPlayersWithApps([appSource]); + const cell = alice.cells[0]; + const agent = cell.cell_id[1]; + + const before: Record | null = await cell.callZome({ + zome_name: "profiles", + fn_name: "get_agent_profile", + payload: { input: agent, local: true }, + }); + assert.isNull(before, "no profile written yet"); + + await cell.callZome({ + zome_name: "profiles", + fn_name: "create_profile", + payload: { nickname: "Alice", fields: {} }, + }); + + const after: Record | null = await cell.callZome({ + zome_name: "profiles", + fn_name: "get_agent_profile", + payload: { input: agent, local: true }, + }); + assert.ok(after, "own profile must be visible locally right after writing it"); + }); +}); + +test('create_profile accepts a second profile for the same agent', async () => { + // Documents why the repair must check before writing. + await runScenario(async scenario => { + const [alice] = await scenario.addPlayersWithApps([appSource]); + const cell = alice.cells[0]; + + await cell.callZome({ + zome_name: "profiles", + fn_name: "create_profile", + payload: { nickname: "Alice", fields: {} }, + }); + const second: Record = await cell.callZome({ + zome_name: "profiles", + fn_name: "create_profile", + payload: { nickname: "Alice", fields: {} }, + }); + assert.ok(second); + }); +}); diff --git a/ui/src/lib/AgentNickname.svelte b/ui/src/lib/AgentNickname.svelte index f129fd55..627b6677 100644 --- a/ui/src/lib/AgentNickname.svelte +++ b/ui/src/lib/AgentNickname.svelte @@ -36,4 +36,7 @@ {$t("common.you")} {:else if nickname !== undefined} {nickname} +{:else} + + {$t("common.unknown_member")} {/if} \ No newline at end of file diff --git a/ui/src/routes/+layout.svelte b/ui/src/routes/+layout.svelte index f38a8924..811095b7 100644 --- a/ui/src/routes/+layout.svelte +++ b/ui/src/routes/+layout.svelte @@ -210,6 +210,11 @@ // Initialize signal handler createSignalHandler(relayClient, conversationStore, conversationMessageStore, onlinePeers); + // Background, never fatal: fill in your profile where a join left it out. + void profileStore.repairMyConversationProfiles().catch((e) => { + console.warn("[profile] repair failed", e); + }); + isStoresSetup = true; } catch (e) { console.error("Failed to init stores", e); diff --git a/ui/src/store/ConversationMessageStore.ts b/ui/src/store/ConversationMessageStore.ts index bd49870c..efb74a66 100644 --- a/ui/src/store/ConversationMessageStore.ts +++ b/ui/src/store/ConversationMessageStore.ts @@ -99,35 +99,16 @@ export function createConversationMessageStore( const messages = createGenericKeyValueStore>(); const paginationState = writable>({}); - const { subscribe } = derived( - [messages, mergedProfileContactInviteStore], - ([$messages, $mergedProfileContactInviteStore]) => { - const filteredMessages = Object.fromEntries( - $messages.list.map(([cellIdB64, messagesData]) => { - const profilesLoaded = - $mergedProfileContactInviteStore.data[cellIdB64] !== undefined; - - const filtered = Object.entries(messagesData).filter(([, msg]) => { - if (!profilesLoaded) return true; - if (msg.message.message_type === MessageType.System) return true; - - return ( - $mergedProfileContactInviteStore.data[cellIdB64]?.[msg.authorAgentPubKeyB64] !== - undefined - ); - }); - - return [cellIdB64, Object.fromEntries(filtered)]; - }), - ); - - return { - data: filteredMessages, - list: Object.entries(filteredMessages), - count: Object.keys(filteredMessages).length, - }; - }, - ); + // Every stored message is shown, whether or not its author has a profile in + // the conversation. Hiding unknown authors silenced members whose profile + // was never written into a conversation (a join can fail after the cell + // exists): their messages were delivered but invisible to everyone, + // themselves included. Unknown authors render as "Unknown member". + const { subscribe } = derived(messages, ($messages) => ({ + data: Object.fromEntries($messages.list), + list: $messages.list, + count: $messages.list.length, + })); async function initialize(): Promise { _log("initialize:start"); diff --git a/ui/src/store/ConversationStore.ts b/ui/src/store/ConversationStore.ts index d727e259..4d5ce0f0 100644 --- a/ui/src/store/ConversationStore.ts +++ b/ui/src/store/ConversationStore.ts @@ -70,7 +70,7 @@ export function createConversationStore(client: RelayClient): ConversationStore async function create(input: CreateConversationInput): Promise { const cellInfo = await client.createConversation(input); await client.setConfig(cellInfo.cell_id, input.config); - await client.setMyProfileForConversation(cellInfo.cell_id); + await client.ensureMyProfileForConversation(cellInfo.cell_id); // just created the conversation so don't go to the network const conversationExtended = await _makeConversationExtended(cellInfo, true); @@ -85,7 +85,7 @@ export function createConversationStore(client: RelayClient): ConversationStore async function join(input: Invitation): Promise { const cellInfo = await client.joinConversation(input); - await client.setMyProfileForConversation(cellInfo.cell_id); + await client.ensureMyProfileForConversation(cellInfo.cell_id); // joining the conversation so go to the network for the config const conversationExtended = await _makeConversationExtended(cellInfo, false); diff --git a/ui/src/store/ProfileStore.ts b/ui/src/store/ProfileStore.ts index a996c778..b95cbbe7 100644 --- a/ui/src/store/ProfileStore.ts +++ b/ui/src/store/ProfileStore.ts @@ -29,6 +29,7 @@ export interface ProfileStore extends GenericKeyKeyValueStore { initialize: () => Promise; createProfile: (val: CreateProfileInputUI) => Promise; updateProfile: (val: CreateProfileInputUI) => Promise; + repairMyConversationProfiles: () => Promise; load: (key: CellIdB64, local: boolean) => Promise; subscribe: ( this: void, @@ -158,6 +159,50 @@ export function createProfileStore(client: RelayClient): ProfileStore { }); } + /** + * Write your profile into active conversations that do not hold it. + * + * Joining creates the conversation first and writes your profile into it as + * a second step. When that step failed — the app closed mid-join, a timeout — + * nothing retried it: the conversation stayed in your list while you were + * missing from its member list. Run once per launch. + * + * Only local data is checked: your own profile, if it exists, was written on + * this device, so a local miss is a real miss and the write never duplicates + * one. Archived conversations are skipped; they are repaired after being + * un-archived and the app restarted. + * + * @returns how many conversations were repaired + */ + async function repairMyConversationProfiles(): Promise { + const myPubKey = client.client.myPubKey; + const myPubKeyB64 = encodeHashToBase64(myPubKey); + + // No profile yet (first run, before creating one): nothing to copy. + const provisioned = await client.getRelayProvisionedCellInfo(); + if (!(await client.getAgentProfile(provisioned.cell_id, myPubKey, true))) return 0; + + let repaired = 0; + for (const cell of await client.getRelayClonedCellInfos()) { + if (!cell.enabled) continue; + const cellIdB64 = encodeCellIdToBase64(cell.cell_id); + try { + if (await client.getAgentProfile(cell.cell_id, myPubKey, true)) continue; + + const record = await client.ensureMyProfileForConversation(cell.cell_id); + const profile = new EntryRecord(record).entry; + if (profile) { + profiles.setKeyKeyValue(cellIdB64, myPubKeyB64, { profile, publicKeyB64: myPubKeyB64 }); + } + repaired++; + console.log(`[profile] wrote missing profile into conversation ${cellIdB64.slice(0, 16)}`); + } catch (e) { + console.warn(`[profile] could not repair profile in ${cellIdB64.slice(0, 16)}`, e); + } + } + return repaired; + } + async function load(key: CellIdB64, local: boolean) { // Get all relay cells const cellInfos = flatten( @@ -188,6 +233,7 @@ export function createProfileStore(client: RelayClient): ProfileStore { load, createProfile, updateProfile, + repairMyConversationProfiles, }; } diff --git a/ui/src/store/RelayClient.ts b/ui/src/store/RelayClient.ts index f6f2038e..088b7a96 100644 --- a/ui/src/store/RelayClient.ts +++ b/ui/src/store/RelayClient.ts @@ -311,6 +311,31 @@ export class RelayClient { }); } + /** Profile writes in progress, per conversation, shared by all callers. */ + private profileWrites = new Map>(); + + /** + * Make sure a conversation holds your profile, writing it only if a + * local-only lookup finds none. Use this rather than + * `setMyProfileForConversation`: create_profile accepts a second profile for + * the same agent, and joining and the start-up repair can both reach the + * same conversation. Concurrent calls for one conversation share one write, + * and later calls find the written profile locally. + */ + ensureMyProfileForConversation(cell_id: CellId): Promise { + const key = encodeCellIdToBase64(cell_id); + const pending = this.profileWrites.get(key); + if (pending) return pending; + + const write = (async () => { + const existing = await this.getAgentProfile(cell_id, this.client.myPubKey, true); + return existing ?? (await this.setMyProfileForConversation(cell_id)); + })().finally(() => this.profileWrites.delete(key)); + + this.profileWrites.set(key, write); + return write; + } + async setMyProfileForConversation(cell_id: CellId): Promise { const record = await this.getAgentProfile(this.provisionedRelayCellId, this.client.myPubKey); if (!record) diff --git a/ui/src/translations/locales/bg.json b/ui/src/translations/locales/bg.json index cef5690a..8dc7afe7 100644 --- a/ui/src/translations/locales/bg.json +++ b/ui/src/translations/locales/bg.json @@ -63,6 +63,7 @@ "welcome_text_2": "Лични, криптирани и защитени с ключове, които само вие контролирате..", "what_is_your_name": "Как се казвате?", "you": "Вие", + "unknown_member": "Неизвестен участник", "update_bar_text": "Volla Messages {{version}} вече е тук. Контактите, които са обновили, вече не могат да получават вашите съобщения — обновете, за да продължите да чатите.", "update_now": "Обнови", "updating": "Обновяване…", diff --git a/ui/src/translations/locales/da.json b/ui/src/translations/locales/da.json index 95304250..b51aa097 100644 --- a/ui/src/translations/locales/da.json +++ b/ui/src/translations/locales/da.json @@ -71,6 +71,7 @@ "welcome_text_2": "Privat, krypteret og sikret med nøgler, som kun du kontrollerer.", "what_is_your_name": "Hvad hedder du?", "you": "Du", + "unknown_member": "Ukendt medlem", "update_bar_text": "Volla Messages {{version}} er her. Kontakter, der har opdateret, kan ikke længere modtage dine beskeder — opdater for at blive ved med at chatte.", "update_now": "Opdater", "updating": "Opdaterer…", diff --git a/ui/src/translations/locales/de.json b/ui/src/translations/locales/de.json index 802a1a58..7273224b 100644 --- a/ui/src/translations/locales/de.json +++ b/ui/src/translations/locales/de.json @@ -102,6 +102,7 @@ "welcome_text_2": "Privat, verschlüsselt und gesichert durch Schlüssel, die nur Sie kontrollieren.", "what_is_your_name": "Wie ist Ihr Name?", "you": "Du", + "unknown_member": "Unbekanntes Mitglied", "update_bar_text": "Volla Messages {{version}} ist da. Kontakte, die bereits aktualisiert haben, können deine Nachrichten nicht mehr empfangen — aktualisiere, um weiter zu chatten.", "update_now": "Aktualisieren", "updating": "Wird aktualisiert…", diff --git a/ui/src/translations/locales/en.json b/ui/src/translations/locales/en.json index 7d353dbd..a2f15ec9 100644 --- a/ui/src/translations/locales/en.json +++ b/ui/src/translations/locales/en.json @@ -102,6 +102,7 @@ "welcome_text_2": "Private, encrypted and secured by keys only you control.", "what_is_your_name": "What is your name?", "you": "You", + "unknown_member": "Unknown member", "update_bar_text": "Volla Messages {{version}} is here. Contacts who have updated can no longer receive your messages — update to keep chatting.", "update_now": "Update", "updating": "Updating…", diff --git a/ui/src/translations/locales/es.json b/ui/src/translations/locales/es.json index 46d07403..e6d2b6a7 100644 --- a/ui/src/translations/locales/es.json +++ b/ui/src/translations/locales/es.json @@ -103,6 +103,7 @@ "welcome_text_2": "Privado, encriptado y protegido por claves que sólo usted controla.", "what_is_your_name": "¿Cuál es su nombre?", "you": "Usted", + "unknown_member": "Miembro desconocido", "update_bar_text": "Ya está aquí Volla Messages {{version}}. Los contactos que han actualizado ya no pueden recibir tus mensajes: actualiza para seguir chateando.", "update_now": "Actualizar", "updating": "Actualizando…", diff --git a/ui/src/translations/locales/fr.json b/ui/src/translations/locales/fr.json index e725ae32..083dcd11 100644 --- a/ui/src/translations/locales/fr.json +++ b/ui/src/translations/locales/fr.json @@ -63,6 +63,7 @@ "welcome_text_2": "Privé, crypté et sécurisé par des clés que vous seul contrôlez.", "what_is_your_name": "Quel est votre nom?", "you": "Tu", + "unknown_member": "Membre inconnu", "update_bar_text": "Volla Messages {{version}} est arrivé. Les contacts qui ont mis à jour ne peuvent plus recevoir vos messages — mettez à jour pour continuer à discuter.", "update_now": "Mettre à jour", "updating": "Mise à jour…", diff --git a/ui/src/translations/locales/hi.json b/ui/src/translations/locales/hi.json index 58aabcc9..cb37616a 100644 --- a/ui/src/translations/locales/hi.json +++ b/ui/src/translations/locales/hi.json @@ -102,6 +102,7 @@ "welcome_text_2": "निजी, एन्क्रिप्टेड और केवल आपके नियंत्रण वाली कुंजियों द्वारा सुरक्षित।", "what_is_your_name": "आपका नाम क्या है?", "you": "आप", + "unknown_member": "अज्ञात सदस्य", "update_bar_text": "Volla Messages {{version}} आ गया है। जिन संपर्कों ने अपडेट कर लिया है, वे अब आपके संदेश प्राप्त नहीं कर सकते — चैट जारी रखने के लिए अपडेट करें।", "update_now": "अपडेट करें", "updating": "अपडेट हो रहा है…", diff --git a/ui/src/translations/locales/it.json b/ui/src/translations/locales/it.json index fd1546ee..169db964 100644 --- a/ui/src/translations/locales/it.json +++ b/ui/src/translations/locales/it.json @@ -103,6 +103,7 @@ "welcome_text_2": "Privati, crittografati e protetti da chiavi che solo voi potete controllare.", "what_is_your_name": "Qual è il suo nome?", "you": "Tu", + "unknown_member": "Membro sconosciuto", "update_bar_text": "Volla Messages {{version}} è disponibile. I contatti che hanno aggiornato non possono più ricevere i tuoi messaggi: aggiorna per continuare a chattare.", "update_now": "Aggiorna", "updating": "Aggiornamento in corso…", diff --git a/ui/src/translations/locales/nl.json b/ui/src/translations/locales/nl.json index fa8dd24a..4602dac1 100644 --- a/ui/src/translations/locales/nl.json +++ b/ui/src/translations/locales/nl.json @@ -74,6 +74,7 @@ "welcome_text_2": "Privé, versleuteld en beveiligd met sleutels die alleen jij beheert.", "what_is_your_name": "Wat is je naam?", "you": "Jij", + "unknown_member": "Onbekend lid", "update_bar_text": "Volla Messages {{version}} is er. Contacten die al hebben bijgewerkt, kunnen je berichten niet meer ontvangen — werk bij om te blijven chatten.", "update_now": "Bijwerken", "updating": "Bijwerken…", diff --git a/ui/src/translations/locales/no.json b/ui/src/translations/locales/no.json index 8576ddf6..17f0774a 100644 --- a/ui/src/translations/locales/no.json +++ b/ui/src/translations/locales/no.json @@ -71,6 +71,7 @@ "welcome_text_2": "Privat, kryptert og sikret med nøkler som kun du kontrollerer.", "what_is_your_name": "Hvad heter du?", "you": "Du", + "unknown_member": "Ukjent medlem", "update_bar_text": "Volla Messages {{version}} er her. Kontakter som har oppdatert, kan ikke lenger motta meldingene dine — oppdater for å fortsette å chatte.", "update_now": "Oppdater", "updating": "Oppdaterer…", diff --git a/ui/src/translations/locales/ro.json b/ui/src/translations/locales/ro.json index e5f8006e..83dba668 100644 --- a/ui/src/translations/locales/ro.json +++ b/ui/src/translations/locales/ro.json @@ -63,6 +63,7 @@ "welcome_text_2": "Privat, criptat și securizat prin chei pe care doar tu le controlezi.", "what_is_your_name": "Care este numele dvs.?", "you": "Tu", + "unknown_member": "Membru necunoscut", "update_bar_text": "Volla Messages {{version}} este aici. Contactele care au actualizat nu îți mai pot primi mesajele — actualizează pentru a continua conversațiile.", "update_now": "Actualizează", "updating": "Se actualizează…", diff --git a/ui/src/translations/locales/sk.json b/ui/src/translations/locales/sk.json index 89bf3392..7cfd0542 100644 --- a/ui/src/translations/locales/sk.json +++ b/ui/src/translations/locales/sk.json @@ -63,6 +63,7 @@ "welcome_text_2": "Súkromné, zašifrované a zabezpečené kľúčmi, ktoré máte pod kontrolou len vy..", "what_is_your_name": "Ako sa voláte?", "you": "Vy", + "unknown_member": "Neznámy člen", "update_bar_text": "Volla Messages {{version}} je tu. Kontakty, ktoré aktualizovali, už nemôžu prijímať vaše správy — aktualizujte, aby ste mohli ďalej četovať.", "update_now": "Aktualizovať", "updating": "Aktualizuje sa…", diff --git a/ui/src/translations/locales/sv.json b/ui/src/translations/locales/sv.json index 859b3c8b..847cbad4 100644 --- a/ui/src/translations/locales/sv.json +++ b/ui/src/translations/locales/sv.json @@ -71,6 +71,7 @@ "welcome_text_2": "Privat, krypterat och säkrat med nycklar som bara du kontrollerar.", "what_is_your_name": "Vad heter du?", "you": "Du", + "unknown_member": "Okänd medlem", "update_bar_text": "Volla Messages {{version}} är här. Kontakter som har uppdaterat kan inte längre ta emot dina meddelanden — uppdatera för att fortsätta chatta.", "update_now": "Uppdatera", "updating": "Uppdaterar…",