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