From ece1528c4a8d7d0d54a8444324c31ebbe4910237 Mon Sep 17 00:00:00 2001 From: Flemmli97 Date: Mon, 4 Nov 2024 17:46:38 +0100 Subject: [PATCH 1/2] update wasm to 1.5.1 --- package.json | 2 +- src/lib/wasm/RaygunStore.ts | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d806f742c..7d8c9a5ea 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,6 @@ "trystero": "^0.20.0", "uuid": "^9.0.1", "vite-plugin-node-polyfills": "^0.21.0", - "warp-wasm": "1.3.5" + "warp-wasm": "1.5.1" } } diff --git a/src/lib/wasm/RaygunStore.ts b/src/lib/wasm/RaygunStore.ts index 0c8304d9d..76d9829e4 100644 --- a/src/lib/wasm/RaygunStore.ts +++ b/src/lib/wasm/RaygunStore.ts @@ -125,7 +125,7 @@ class RaygunStore { await r.create_group_conversation( name, recipients.map(r => r.key), - new wasm.GroupSettings() + new wasm.GroupPermissions() ), r ), @@ -159,7 +159,15 @@ class RaygunStore { } async updateConversationSettings(conversation_id: string, settings: ConversationSettings) { - return await this.get(r => r.update_conversation_settings(conversation_id, settings), "Error updating conversation settings") + return await this.get(async r => { + let conv = await r.get_conversation(conversation_id) + // TODO. this needs ui revamp as its now user based and not global + r.update_conversation_permissions(conversation_id, conv.permissions()) + }, "Error updating conversation settings") + } + + async updateConversationDescription(conversation_id: string, description: string) { + return await this.get(r => r.set_conversation_description(conversation_id, description), "Error updating conversation settings") } /** @@ -177,7 +185,7 @@ class RaygunStore { let convs = await r.list_conversations() convs .convs() - .filter(c => parseJSValue(c.settings()).type === "direct" && recipient in c.recipients()) + .filter(c => c.conversation_type() === wasm.ConversationType.Direct && recipient in c.recipients()) .forEach(async conv => { await this.get(r => r.delete(conv.id(), undefined), "Error deleting message") }) @@ -799,8 +807,7 @@ class RaygunStore { * Converts warp message to ui message */ private async convertWarpConversation(chat: wasm.Conversation, raygun: wasm.RayGunBox): Promise { - let setting = parseJSValue(chat.settings()) - let direct = setting.type === "direct" + let direct = chat.conversation_type() === wasm.ConversationType.Direct let msg = await this.getMessages(raygun, chat.id(), new MessageOptions()) chat.recipients().forEach(async recipient => { let user = await MultipassStoreInstance.identity_from_did(recipient) @@ -816,10 +823,11 @@ class RaygunStore { settings: { displayOwnerBadge: true, readReceipts: true, + // TODO. this needs ui revamp as its now user based and not global permissions: { - allowAnyoneToAddUsers: !direct && (setting.values["members_can_add_participants"] as boolean), + allowAnyoneToAddUsers: !direct && true, allowAnyoneToModifyPhoto: false, - allowAnyoneToModifyName: !direct && (setting.values["members_can_change_name"] as boolean), + allowAnyoneToModifyName: !direct && true, }, }, creator: chat.creator(), From 4e152e6c4ce19d384e3fa5d519c53cf713d963e9 Mon Sep 17 00:00:00 2001 From: Flemmli97 Date: Tue, 5 Nov 2024 14:08:52 +0100 Subject: [PATCH 2/2] fix tesseract delete --- src/lib/wasm/TesseractStore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/wasm/TesseractStore.ts b/src/lib/wasm/TesseractStore.ts index 8abc63330..dfb0b983b 100644 --- a/src/lib/wasm/TesseractStore.ts +++ b/src/lib/wasm/TesseractStore.ts @@ -72,7 +72,7 @@ class TesseractStore { removeSeed() { const tesseract = get(this.tesseractWritable) if (!tesseract?.exist("mnemonic")) return - tesseract?._delete("mnemonic") + tesseract?.delete("mnemonic") } async initTesseract(from?: wasm.Tesseract) {