From 77b4d193b0db728f42752b47ad0c3fbcdfc8d766 Mon Sep 17 00:00:00 2001 From: techyminati Date: Tue, 25 Aug 2026 21:30:54 +0530 Subject: [PATCH 1/8] volla-messages: add message forwarding Add a Forward action to messages, letting users send an existing message's text and attachments to another conversation. Change-Id: I8e6c0c45736115d7e12f8dfae8ff85c5d63bfb6f --- ui/src/routes/conversations/[id]/+page.svelte | 81 ++++++++++++++++++- .../[id]/ConversationMessages.svelte | 1 + .../conversations/[id]/ForwardDialog.svelte | 40 +++++++++ .../routes/conversations/[id]/Message.svelte | 2 +- .../conversations/[id]/MessageActions.svelte | 12 +++ ui/src/translations/locales/en.json | 5 ++ ui/src/translations/locales/hi.json | 5 ++ 7 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 ui/src/routes/conversations/[id]/ForwardDialog.svelte diff --git a/ui/src/routes/conversations/[id]/+page.svelte b/ui/src/routes/conversations/[id]/+page.svelte index 0811413c..551893ab 100644 --- a/ui/src/routes/conversations/[id]/+page.svelte +++ b/ui/src/routes/conversations/[id]/+page.svelte @@ -1,11 +1,21 @@ + + + {#if conversations.length === 0} +

+ {$t("common.no_conversations_to_forward")} +

+ {:else} + + {/if} +
diff --git a/ui/src/routes/conversations/[id]/Message.svelte b/ui/src/routes/conversations/[id]/Message.svelte index 177ff9c5..670f778e 100644 --- a/ui/src/routes/conversations/[id]/Message.svelte +++ b/ui/src/routes/conversations/[id]/Message.svelte @@ -116,7 +116,7 @@ {#if isSelected} - + {/if} diff --git a/ui/src/routes/conversations/[id]/MessageActions.svelte b/ui/src/routes/conversations/[id]/MessageActions.svelte index 278dc494..bcb4f729 100644 --- a/ui/src/routes/conversations/[id]/MessageActions.svelte +++ b/ui/src/routes/conversations/[id]/MessageActions.svelte @@ -21,6 +21,7 @@ const dispatch = createEventDispatcher<{ delete: ActionHashB64; + forward: MessageExtended; }>(); const myPubKeyB64 = getContext<{ getMyPubKeyB64: () => AgentPubKeyB64 }>( @@ -107,6 +108,17 @@ {/if} + {#if hasText || message.message.images.length > 0} + dispatch("forward", message)} + icon="share" + moreClassesButton="bg-tertiary-600 dark:bg-secondary-700 dark:text-tertiary-400" + moreClasses="w-[30px]" + > + {$t("common.forward")} + + {/if} + {#if iAmAuthor} dispatch("delete", actionHashB64)} diff --git a/ui/src/translations/locales/en.json b/ui/src/translations/locales/en.json index 9efcde0a..e24c2901 100644 --- a/ui/src/translations/locales/en.json +++ b/ui/src/translations/locales/en.json @@ -51,7 +51,12 @@ "error_sending_message": "Failed to send message", "first": "First", "first_name": "First Name", + "forward": "Forward", + "forward_error": "Failed to forward message", + "forward_success": "Message forwarded", + "forward_to": "Forward to", "group_name": "Group name", + "no_conversations_to_forward": "No other conversations to forward to", "holochain_connect_error": "Error connecting to Holochain", "images": "{{count}} {{count; 1:image; default:images;}}", "files": "{{count}} {{count; 1:file; default:files;}}", diff --git a/ui/src/translations/locales/hi.json b/ui/src/translations/locales/hi.json index 9f5fd443..35172306 100644 --- a/ui/src/translations/locales/hi.json +++ b/ui/src/translations/locales/hi.json @@ -51,7 +51,12 @@ "error_sending_message": "संदेश भेजने में विफल", "first": "पहला", "first_name": "पहला नाम", + "forward": "अग्रेषित करें", + "forward_error": "संदेश अग्रेषित करने में विफल", + "forward_success": "संदेश अग्रेषित किया गया", + "forward_to": "इन्हें अग्रेषित करें", "group_name": "समूह का नाम", + "no_conversations_to_forward": "अग्रेषित करने के लिए कोई अन्य बातचीत नहीं है", "holochain_connect_error": "Holochain से कनेक्ट करने में त्रुटि", "images": "{{count}} {{count; 1:छवि; default:छवियाँ;}}", "files": "{{count}} {{count; 1:फ़ाइल; default:फ़ाइलें;}}", From 15efd58e2853f305663cccb4f771739cb1da7acf Mon Sep 17 00:00:00 2001 From: techyminati Date: Tue, 25 Aug 2026 21:49:35 +0530 Subject: [PATCH 2/8] volla-messages Star messages to bookmark them Adds a star toggle to the message actions. Starred messages are remembered locally by action hash and show a small star under the bubble. Handy for pinning something important without sharing that choice with anyone else. Change-Id: I967cee4bbf1d0e56b19b5a0af91b0a13898a4bb5 Signed-off-by: techyminati --- ui/src/lib/svgIcons.ts | 8 ++++++++ .../routes/conversations/[id]/Message.svelte | 8 ++++++++ .../conversations/[id]/MessageActions.svelte | 12 +++++++++++ ui/src/store/StarStore.ts | 20 +++++++++++++++++++ ui/src/translations/locales/en.json | 2 ++ ui/src/translations/locales/hi.json | 2 ++ 6 files changed, 52 insertions(+) create mode 100644 ui/src/store/StarStore.ts diff --git a/ui/src/lib/svgIcons.ts b/ui/src/lib/svgIcons.ts index ff2a3c0d..8a1bb450 100644 --- a/ui/src/lib/svgIcons.ts +++ b/ui/src/lib/svgIcons.ts @@ -18,6 +18,14 @@ export const svgIcons: { [key: string]: string } = { '', arrowRight: '', + bell: + '', + bellOff: + '', + star: + '', + starFilled: + '', betaTag: '', caretDown: diff --git a/ui/src/routes/conversations/[id]/Message.svelte b/ui/src/routes/conversations/[id]/Message.svelte index 670f778e..dd0231c3 100644 --- a/ui/src/routes/conversations/[id]/Message.svelte +++ b/ui/src/routes/conversations/[id]/Message.svelte @@ -11,6 +11,8 @@ import MessageFilePreview from "./MessageFilePreview.svelte"; import { encodeHashToBase64, type ActionHashB64, type AgentPubKeyB64 } from "@holochain/client"; import AgentNickname from "$lib/AgentNickname.svelte"; + import SvgIcon from "$lib/SvgIcon.svelte"; + import { starredMessages } from "$store/StarStore"; import { openUrl } from "@tauri-apps/plugin-opener"; import DeliveryStatusIndicator from "./DeliveryStatusIndicator.svelte"; import { computeDeliveryStatus } from "$lib/utils"; @@ -112,6 +114,12 @@ recipientCount={recipientPubKeyB64s.length} />{/if} + + {#if $starredMessages[actionHashB64]} + + + + {/if} diff --git a/ui/src/routes/conversations/[id]/MessageActions.svelte b/ui/src/routes/conversations/[id]/MessageActions.svelte index bcb4f729..63b3a254 100644 --- a/ui/src/routes/conversations/[id]/MessageActions.svelte +++ b/ui/src/routes/conversations/[id]/MessageActions.svelte @@ -11,6 +11,7 @@ import { createEventDispatcher, getContext } from "svelte"; import { page } from "$app/stores"; import { encodeHashToBase64, type ActionHashB64, type AgentPubKeyB64 } from "@holochain/client"; + import { starredMessages, toggleStar } from "$store/StarStore"; const fileStore = getContext<{ getStore: () => FileStore; }>("fileStore").getStore(); @@ -108,6 +109,17 @@ {/if} + toggleStar(actionHashB64)} + icon={$starredMessages[actionHashB64] ? "starFilled" : "star"} + moreClassesButton="bg-tertiary-600 dark:bg-secondary-700 dark:text-tertiary-400" + moreClasses="w-[30px]" + > + {$starredMessages[actionHashB64] ? $t("common.unstar") : $t("common.star")} + + {#if hasText || message.message.images.length > 0} dispatch("forward", message)} diff --git a/ui/src/store/StarStore.ts b/ui/src/store/StarStore.ts new file mode 100644 index 00000000..143bbddb --- /dev/null +++ b/ui/src/store/StarStore.ts @@ -0,0 +1,20 @@ +import { persisted } from "./generic/GenericPersistedStore"; +import type { ActionHashB64 } from "@holochain/client"; + +// Starred messages, kept locally and keyed by message action hash (which is +// globally unique). Purely a personal bookmark; nothing is shared with peers. +export const starredMessages = persisted<{ [actionHashB64: ActionHashB64]: boolean }>( + "MESSAGE.STARRED", + {}, +); + +export function toggleStar(actionHashB64: ActionHashB64): void { + starredMessages.update((s) => { + if (s[actionHashB64]) { + const next = { ...s }; + delete next[actionHashB64]; + return next; + } + return { ...s, [actionHashB64]: true }; + }); +} diff --git a/ui/src/translations/locales/en.json b/ui/src/translations/locales/en.json index e24c2901..c4b64ac5 100644 --- a/ui/src/translations/locales/en.json +++ b/ui/src/translations/locales/en.json @@ -93,6 +93,8 @@ "share_invitation_code_msg": "Nobody else is here! Share your invite code to start the conversation.", "share_invite_code": "Share invite code", "share_your_contact_code": "Share your contact code", + "star": "Star", + "unstar": "Unstar", "stores_setup": "Loading initial data...", "stores_setup_error": "Error setting up data stores", "tagline": "Peer-to-peer. Encrypted. Secure.", diff --git a/ui/src/translations/locales/hi.json b/ui/src/translations/locales/hi.json index 35172306..268edc45 100644 --- a/ui/src/translations/locales/hi.json +++ b/ui/src/translations/locales/hi.json @@ -93,6 +93,8 @@ "share_invitation_code_msg": "यहाँ और कोई नहीं है! बातचीत शुरू करने के लिए अपना आमंत्रण कोड साझा करें।", "share_invite_code": "आमंत्रण कोड साझा करें", "share_your_contact_code": "अपना संपर्क कोड साझा करें", + "star": "तारांकित करें", + "unstar": "तारांकन हटाएँ", "stores_setup": "प्रारंभिक डेटा लोड हो रहा है...", "stores_setup_error": "डेटा स्टोर सेट अप करने में त्रुटि", "tagline": "पीयर-टू-पीयर। एन्क्रिप्टेड। सुरक्षित।", From afc2a05fc0ea8bbc3d6871dc480b0cf005ee8a7e Mon Sep 17 00:00:00 2001 From: erascape Date: Tue, 25 Aug 2026 21:55:18 +0530 Subject: [PATCH 3/8] volla-messages: Allow editing your own messages Wires up the existing update_message zome call. The author picks Edit from the message actions, changes the text, and the update is written to the DHT and reflected locally with an "edited" marker. Edits follow the update chain so a message can be changed more than once. NOTE:- Peers pick up the new text when they refetch the message; there's no live update signal yet, so this is deliberately author-side for now. Change-Id: I8d407b03f684e0e9656e6867d1974a4f4c18e75d Signed-off-by: techyminati --- ui/src/lib/types.ts | 12 ++++++ ui/src/routes/conversations/[id]/+page.svelte | 43 +++++++++++++++++++ .../[id]/ConversationMessages.svelte | 1 + .../routes/conversations/[id]/Message.svelte | 9 +++- .../conversations/[id]/MessageActions.svelte | 12 ++++++ ui/src/store/ConversationMessageStore.ts | 38 ++++++++++++++++ ui/src/store/RelayClient.ts | 10 +++++ ui/src/translations/locales/en.json | 4 ++ ui/src/translations/locales/hi.json | 4 ++ 9 files changed, 132 insertions(+), 1 deletion(-) diff --git a/ui/src/lib/types.ts b/ui/src/lib/types.ts index 81b3c9f1..2454f48c 100644 --- a/ui/src/lib/types.ts +++ b/ui/src/lib/types.ts @@ -1,5 +1,6 @@ import type { ActionHash, + ActionHashB64, AgentPubKeyB64, CellId, EntryHash, @@ -105,6 +106,11 @@ export interface MessageExtended { authorAgentPubKeyB64: AgentPubKeyB64; timestamp: number; deliveredTo: AgentPubKeyB64[]; + + // Set once the author has edited the message. latestUpdateActionHashB64 is the + // head of the update chain, needed as the previous hash for any further edit. + edited?: boolean; + latestUpdateActionHashB64?: ActionHashB64; } export enum DeliveryStatus { @@ -135,6 +141,12 @@ export interface DeleteMessageInput { agents: AgentPubKey[]; } +export interface UpdateMessageInput { + original_message_hash: ActionHash; + previous_message_hash: ActionHash; + updated_message: Message; +} + /** * Conversation */ diff --git a/ui/src/routes/conversations/[id]/+page.svelte b/ui/src/routes/conversations/[id]/+page.svelte index 551893ab..f6280774 100644 --- a/ui/src/routes/conversations/[id]/+page.svelte +++ b/ui/src/routes/conversations/[id]/+page.svelte @@ -114,6 +114,11 @@ let deleteMessageActionHashB64: ActionHashB64 | undefined = undefined; let isDeletingMessage = false; + let showEditDialog = false; + let editActionHashB64: ActionHashB64 | undefined = undefined; + let editText = ""; + let isEditingMessage = false; + let isFirstConfigLoad = true; let isFirstProfilesLoad = true; let isFirstLoadMessages = true; @@ -147,6 +152,29 @@ showForwardDialog = true; } + function openEdit(actionHashB64: ActionHashB64, content: string) { + editActionHashB64 = actionHashB64; + editText = content; + showEditDialog = true; + } + + async function handleEditMessage() { + if (editActionHashB64 === undefined || isEditingMessage) return; + const content = editText.trim(); + if (content.length === 0) return; + + isEditingMessage = true; + try { + await messages.updateMessage(editActionHashB64, content); + showEditDialog = false; + editActionHashB64 = undefined; + } catch (err) { + console.error(err); + toast.error($t("common.edit_message_error")); + } + isEditingMessage = false; + } + async function handleForwardTo(targetCellIdB64: CellIdB64) { const message = forwardMessage; if (message === undefined || isForwarding) return; @@ -390,6 +418,7 @@ async function loadMoreMessages() { showDeleteDialog = true; }} on:forward={(e) => openForward(e.detail)} + on:edit={(e) => openEdit(e.detail.actionHashB64, e.detail.content)} on:scrollAtTop={loadMoreMessages} /> @@ -415,6 +444,20 @@ async function loadMoreMessages() {

{$t("common.delete_message_dialog_message")}

+ +