From 69accaebef9fc84f25b1304a6d02f8d75caa27fb Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Thu, 14 Aug 2025 16:11:27 +0530 Subject: [PATCH] fix: conversations not reopening on reply from contacts (only when there's an attachment in the reply) else the convo would reopen, the conversation_uuid field was empty as it wasn't part of the get-messages query. --- internal/conversation/queries.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/conversation/queries.sql b/internal/conversation/queries.sql index 80d06177..855b8ddc 100644 --- a/internal/conversation/queries.sql +++ b/internal/conversation/queries.sql @@ -438,6 +438,7 @@ SELECT m.sender_type, m.sender_id, m.meta, + c.uuid as conversation_uuid, COALESCE( json_agg( json_build_object( @@ -452,10 +453,11 @@ SELECT '[]'::json ) AS attachments FROM conversation_messages m +INNER JOIN conversations c ON c.id = m.conversation_id LEFT JOIN media ON media.model_type = 'messages' AND media.model_id = m.id WHERE m.uuid = $1 GROUP BY - m.id, m.created_at, m.updated_at, m.status, m.type, m.content, m.uuid, m.private, m.sender_type + m.id, m.created_at, m.updated_at, m.status, m.type, m.content, m.uuid, m.private, m.sender_type, c.uuid ORDER BY m.created_at; -- name: get-messages