feat: allow disabling private note

This commit is contained in:
Shivam Mishra
2025-06-17 13:17:06 +05:30
parent f0e376c0d9
commit 4502ed6213
2 changed files with 12 additions and 1 deletions
@@ -18,6 +18,7 @@ export const ChatwootProvider = ({
conversationId,
disableUpload,
disableEditor,
disablePrivateNote,
children,
}) => {
const isInitialized = useRef(false);
@@ -38,6 +39,7 @@ export const ChatwootProvider = ({
accountId: Number(accountId),
conversationId: Number(conversationId),
disableEditor: disableEditor || false,
disablePrivateNote: disablePrivateNote || false,
disableUpload: disableUpload || false,
websocketURL: websocketURL,
pubsubToken: pubsubToken,
@@ -56,6 +58,7 @@ export const ChatwootProvider = ({
window.__PUBSUB_TOKEN__ = config.pubsubToken;
window.__WOOT_CONVERSATION_ID__ = config.conversationId;
window.__EDITOR_DISABLE_UPLOAD__ = config.disableUpload;
window.__EDITOR_DISABLE_PRIVATE_NOTE__ = config.disablePrivateNote;
window.__DISABLE_EDITOR__ = config.disableEditor;
window.__WOOT_ISOLATED_SHELL__ = true;
/* eslint-enable no-underscore-dangle */
+9 -1
View File
@@ -107,6 +107,10 @@ export default {
maxLength() {
return MESSAGE_MAX_LENGTH.GENERAL;
},
allowPrivateNote() {
// eslint-disable-next-line no-underscore-dangle
return window.__EDITOR_DISABLE_PRIVATE_NOTE__ !== true;
},
isEditorDisabled() {
// eslint-disable-next-line no-underscore-dangle
return window.__DISABLE_EDITOR__;
@@ -123,7 +127,7 @@ export default {
},
replyBoxClass() {
return {
'is-private': this.isPrivate,
'is-private': this.isPrivate && this.allowPrivateNote,
'is-focused': this.isFocused || this.hasAttachments,
'pointer-events-none grayscale opacity-70': this.isEditorDisabled,
};
@@ -132,6 +136,7 @@ export default {
return this.attachedFiles.length;
},
isOnPrivateNote() {
if (!this.allowPrivateNote) return false;
return this.replyType === REPLY_EDITOR_MODES.NOTE;
},
isOnExpandedLayout() {
@@ -222,6 +227,8 @@ export default {
}
},
setReplyMode(mode = REPLY_EDITOR_MODES.REPLY) {
if (!this.allowPrivateNote) return;
const { can_reply: canReply } = this.currentChat;
this.$store.dispatch('draftMessages/setReplyEditorMode', {
mode,
@@ -381,6 +388,7 @@ export default {
<template>
<div ref="replyEditor" class="reply-box" :class="replyBoxClass">
<ReplyTopPanel
v-if="allowPrivateNote"
:mode="replyType"
disable-popout
:is-message-length-reaching-threshold="isMessageLengthReachingThreshold"