From 5468d5c3085849185e0c4cea7a39995469a250ba Mon Sep 17 00:00:00 2001 From: Nikhil Kothari Date: Thu, 15 Feb 2024 22:06:02 +0530 Subject: [PATCH] fix: only allow plain text messages in timeline --- .../Renderers/DoctypeLinkRenderer.tsx | 4 +-- raven/public/js/timeline_button.js | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/raven-app/src/components/feature/chat/ChatMessage/Renderers/DoctypeLinkRenderer.tsx b/raven-app/src/components/feature/chat/ChatMessage/Renderers/DoctypeLinkRenderer.tsx index 27bef7728..b842d842d 100644 --- a/raven-app/src/components/feature/chat/ChatMessage/Renderers/DoctypeLinkRenderer.tsx +++ b/raven-app/src/components/feature/chat/ChatMessage/Renderers/DoctypeLinkRenderer.tsx @@ -1,5 +1,5 @@ import { useToast } from "@/hooks/useToast" -import { Flex, IconButton, Link, Text } from "@radix-ui/themes" +import { Flex, IconButton, Link } from "@radix-ui/themes" import { BiLink, BiRightArrowAlt } from "react-icons/bi" import { FiExternalLink } from "react-icons/fi" @@ -34,7 +34,7 @@ export const DoctypeLinkRenderer = ({ doctype, docname }: { doctype: string, doc className="border-2 bg-gray-2 dark:bg-gray-4 rounded-md border-gray-4 dark:border-gray-6 shadow-sm"> - Linked with {doctype}: {docname} + {doctype}: {docname} diff --git a/raven/public/js/timeline_button.js b/raven/public/js/timeline_button.js index ca17d6421..51f81f77d 100644 --- a/raven/public/js/timeline_button.js +++ b/raven/public/js/timeline_button.js @@ -141,16 +141,14 @@ $(document).on('app_ready', function () {

  - + ${frappe.utils.icon('link-url')}

`); @@ -194,7 +192,7 @@ $(document).on('app_ready', function () { { fieldname: 'message', label: 'Message', - fieldtype: 'Text Editor', + fieldtype: 'Long Text', // reqd: 1, }, { fieldtype: 'Section Break' }, @@ -280,6 +278,20 @@ $(document).on('app_ready', function () { doctype: 'Raven Message', channel_id: channel, text: message, + json: { + "content": [ + { + "content": [ + { + "text": message, + "type": "text" + } + ], + "type": "paragraph" + } + ], + "type": "doc" + }, message_type: get_type(res?.message?.file_url), file: res?.message?.file_url || '', link_doctype: frm.doctype,