fix: Shows tooltip and avatar for template messages (#3898)

This commit is contained in:
Nithin David Thomas 2022-02-03 12:14:34 +05:30 committed by GitHub
parent 8dcb4a5ed4
commit 5c6958482f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,7 +64,7 @@
> >
<woot-thumbnail <woot-thumbnail
:src="sender.thumbnail" :src="sender.thumbnail"
:username="sender.name" :username="senderNameForAvatar"
size="16px" size="16px"
/> />
<a <a
@ -248,6 +248,9 @@ export default {
isOutgoing() { isOutgoing() {
return this.data.message_type === MESSAGE_TYPE.OUTGOING; return this.data.message_type === MESSAGE_TYPE.OUTGOING;
}, },
isTemplate() {
return this.data.message_type === MESSAGE_TYPE.TEMPLATE;
},
emailHeadAttributes() { emailHeadAttributes() {
return { return {
email: this.contentAttributes.email, email: this.contentAttributes.email,
@ -265,8 +268,12 @@ export default {
return !!this.data.content; return !!this.data.content;
}, },
tooltipForSender() { tooltipForSender() {
const { name = this.$t('CONVERSATION.BOT') } = this.sender || {}; const name = this.senderNameForAvatar;
return this.data.message_type === MESSAGE_TYPE.OUTGOING const { message_type: messageType } = this.data;
const showTooltip =
messageType === MESSAGE_TYPE.OUTGOING ||
messageType === MESSAGE_TYPE.TEMPLATE;
return showTooltip
? { ? {
content: `${this.$t('CONVERSATION.SENT_BY')} ${name}`, content: `${this.$t('CONVERSATION.SENT_BY')} ${name}`,
classes: 'top', classes: 'top',
@ -323,11 +330,18 @@ export default {
return meta ? meta.error : ''; return meta ? meta.error : '';
}, },
showAvatar() { showAvatar() {
if (this.isOutgoing) { if (this.isOutgoing || this.isTemplate) {
return this.sender; return true;
} }
return this.isATweet && this.isIncoming && this.sender; return this.isATweet && this.isIncoming && this.sender;
}, },
senderNameForAvatar() {
if (this.isOutgoing || this.isTemplate) {
const { name = this.$t('CONVERSATION.BOT') } = this.sender || {};
return name;
}
return '';
},
}, },
watch: { watch: {
data() { data() {