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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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';
export default {
name: 'ReplyTopPanel',
name: 'ReplyBottomPanel',
components: { FileUpload },
mixins: [eventListenerMixins, uiSettingsMixin, inboxMixin],
props: {

View file

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