From 6d541a8d39a1ab2a7d61a0335e10f654f14b8e13 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 19 Mar 2026 10:46:22 +0530 Subject: [PATCH] feat: force read-only signature --- .../components/widgets/WootWriter/Editor.vue | 6 +++--- app/javascript/ui/LiteReplyBox.vue | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue b/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue index 6e7fca8e3..9d3e1c1d8 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue @@ -797,8 +797,8 @@ watch( ); watch(sendWithSignature, newValue => { - // see if the allowSignature flag is true - if (props.allowSignature) { + // When forceSignature is true, signature is managed outside the editor + if (props.allowSignature && !props.forceSignature) { toggleSignatureInEditor(newValue); } }); @@ -816,7 +816,7 @@ onMounted(async () => { createEditorView(); editorView.updateState(state); // TODO: test this in the main app - if (sendWithSignature.value) { + if (sendWithSignature.value && !props.forceSignature) { addSignature(); } else if (props.focusOnMount) { focusEditorInputField(); diff --git a/app/javascript/ui/LiteReplyBox.vue b/app/javascript/ui/LiteReplyBox.vue index a0214ae7d..aef8606dc 100644 --- a/app/javascript/ui/LiteReplyBox.vue +++ b/app/javascript/ui/LiteReplyBox.vue @@ -13,7 +13,10 @@ import WootMessageEditor from 'dashboard/components/widgets/WootWriter/Editor.vu import { MESSAGE_MAX_LENGTH } from 'shared/helpers/MessageTypeHelper'; import inboxMixin from 'shared/mixins/inboxMixin'; import fileUploadMixin from 'dashboard/mixins/fileUploadMixin'; -import { extractTextFromMarkdown } from 'dashboard/helper/editorHelper'; +import { + appendSignature, + extractTextFromMarkdown, +} from 'dashboard/helper/editorHelper'; export default { components: { @@ -393,9 +396,14 @@ export default { return payload; }, getMessagePayload(message) { + // When signature is forced, append it at send time (not in editor) + const finalMessage = + this.hasCustomSignature && this.signatureToApply + ? appendSignature(message, this.signatureToApply, this.channelType) + : message; let messagePayload = { conversationId: this.currentChat.id, - message, + message: finalMessage, private: this.isPrivate, sender: this.sender, }; @@ -459,6 +467,12 @@ export default { @clear-selection="clearEditorSelection" /> +
+ --
{{ signatureToApply }} +