fix: Message signature going with other channels message (#4024)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Nithin David Thomas
2022-02-25 16:36:10 +05:30
committed by GitHub
parent 6c94768bdb
commit 2c8a3ef3b2
3 changed files with 34 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ import { ALLOWED_FILE_TYPES } from 'shared/constants/messages';
import { REPLY_EDITOR_MODES } from './constants'; import { REPLY_EDITOR_MODES } from './constants';
export default { export default {
name: 'ReplyTopPanel', name: 'ReplyBottomPanel',
components: { FileUpload }, components: { FileUpload },
mixins: [eventListenerMixins, uiSettingsMixin, inboxMixin], mixins: [eventListenerMixins, uiSettingsMixin, inboxMixin],
props: { props: {

View File

@@ -67,11 +67,21 @@
/> />
</div> </div>
<div <div
v-if="showMessageSignature" v-if="isSignatureEnabledForInbox"
v-tooltip="$t('CONVERSATION.FOOTER.MESSAGE_SIGN_TOOLTIP')" v-tooltip="$t('CONVERSATION.FOOTER.MESSAGE_SIGN_TOOLTIP')"
class="message-signature-wrap" class="message-signature-wrap"
> >
<p class="message-signature" v-html="formatMessage(messageSignature)" /> <p
v-if="isSignatureAvailable"
class="message-signature"
v-html="formatMessage(messageSignature)"
/>
<p v-else class="message-signature">
{{ $t('CONVERSATION.FOOTER.MESSAGE_SIGNATURE_NOT_CONFIGURED') }}
<router-link :to="profilePath">
{{ $t('CONVERSATION.FOOTER.CLICK_HERE') }}
</router-link>
</p>
</div> </div>
<reply-bottom-panel <reply-bottom-panel
:mode="replyType" :mode="replyType"
@@ -124,6 +134,7 @@ import { MESSAGE_MAX_LENGTH } from 'shared/helpers/MessageTypeHelper';
import inboxMixin from 'shared/mixins/inboxMixin'; import inboxMixin from 'shared/mixins/inboxMixin';
import uiSettingsMixin from 'dashboard/mixins/uiSettings'; import uiSettingsMixin from 'dashboard/mixins/uiSettings';
import { DirectUpload } from 'activestorage'; import { DirectUpload } from 'activestorage';
import { frontendURL } from '../../../helper/URLHelper';
export default { export default {
components: { components: {
@@ -180,6 +191,7 @@ export default {
messageSignature: 'getMessageSignature', messageSignature: 'getMessageSignature',
currentUser: 'getCurrentUser', currentUser: 'getCurrentUser',
globalConfig: 'globalConfig/get', globalConfig: 'globalConfig/get',
accountId: 'getCurrentAccountId',
}), }),
showRichContentEditor() { showRichContentEditor() {
@@ -350,13 +362,19 @@ export default {
enableMultipleFileUpload() { enableMultipleFileUpload() {
return this.isAnEmailChannel || this.isAWebWidgetInbox || this.isAPIInbox; return this.isAnEmailChannel || this.isAWebWidgetInbox || this.isAPIInbox;
}, },
showMessageSignature() { isSignatureEnabledForInbox() {
return !this.isPrivate && this.isAnEmailChannel && this.sendWithSignature; return !this.isPrivate && this.isAnEmailChannel && this.sendWithSignature;
}, },
isSignatureAvailable() {
return !!this.messageSignature;
},
sendWithSignature() { sendWithSignature() {
const { send_with_signature: isEnabled } = this.uiSettings; const { send_with_signature: isEnabled } = this.uiSettings;
return isEnabled; return isEnabled;
}, },
profilePath() {
return frontendURL(`accounts/${this.accountId}/profile/settings`);
},
}, },
watch: { watch: {
currentChat(conversation) { currentChat(conversation) {
@@ -469,7 +487,7 @@ export default {
} }
if (!this.showMentions) { if (!this.showMentions) {
let newMessage = this.message; let newMessage = this.message;
if (this.sendWithSignature && this.messageSignature) { if (this.isSignatureEnabledForInbox && this.messageSignature) {
newMessage += '\n\n' + this.messageSignature; newMessage += '\n\n' + this.messageSignature;
} }
const messagePayload = this.getMessagePayload(newMessage); const messagePayload = this.getMessagePayload(newMessage);
@@ -713,4 +731,12 @@ export default {
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.08)); filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.08));
} }
} }
.message-signature {
margin-bottom: 0;
::v-deep p:last-child {
margin-bottom: 0;
}
}
</style> </style>

View File

@@ -61,7 +61,9 @@
"ENABLE_SIGN_TOOLTIP": "Enable signature", "ENABLE_SIGN_TOOLTIP": "Enable signature",
"DISABLE_SIGN_TOOLTIP": "Disable signature", "DISABLE_SIGN_TOOLTIP": "Disable signature",
"MSG_INPUT": "Shift + enter for new line. Start with '/' to select a Canned Response.", "MSG_INPUT": "Shift + enter for new line. Start with '/' to select a Canned Response.",
"PRIVATE_MSG_INPUT": "Shift + enter for new line. This will be visible only to Agents" "PRIVATE_MSG_INPUT": "Shift + enter for new line. This will be visible only to Agents",
"MESSAGE_SIGNATURE_NOT_CONFIGURED": "Message signature is not configured, please configure it in profile settings.",
"CLICK_HERE": "Click here to update"
}, },
"REPLYBOX": { "REPLYBOX": {
"REPLY": "Reply", "REPLY": "Reply",