Chore: Fix issues with conversation data models (#1000)

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S
2020-07-04 19:46:17 +05:30
committed by GitHub
parent 36661ea45d
commit 4612494923
15 changed files with 147 additions and 51 deletions

View File

@@ -7,7 +7,7 @@
<Thumbnail
v-if="!hideThumbnail"
:src="currentContact.thumbnail"
:badge="currentContact.channel"
:badge="chatMetadata.channel"
class="columns"
:username="currentContact.name"
:status="currentContact.availability_status"
@@ -88,9 +88,13 @@ export default {
accountId: 'getCurrentAccountId',
}),
chatMetadata() {
return this.chat.meta;
},
currentContact() {
return this.$store.getters['contacts/getContact'](
this.chat.meta.sender.id
this.chatMetadata.sender.id
);
},

View File

@@ -4,7 +4,7 @@
<Thumbnail
:src="currentContact.thumbnail"
size="40px"
:badge="currentContact.channel"
:badge="chatMetadata.channel"
:username="currentContact.name"
:status="currentContact.availability_status"
/>
@@ -29,7 +29,7 @@
:allow-empty="true"
deselect-label="Remove"
placeholder="Select Agent"
selected-label=""
selected-label
select-label="Assign"
track-by="id"
@select="assignAgent"
@@ -81,6 +81,10 @@ export default {
currentChat: 'getSelectedChat',
}),
chatMetadata() {
return this.chat.meta;
},
currentContact() {
return this.$store.getters['contacts/getContact'](
this.chat.meta.sender.id

View File

@@ -121,23 +121,6 @@ export default {
);
return chat;
},
// Get current FB Page ID
getPageId() {
let stateInbox;
if (this.inboxId) {
const inboxId = Number(this.inboxId);
[stateInbox] = this.inboxesList.filter(
inbox => inbox.channel_id === inboxId
);
} else {
[stateInbox] = this.inboxesList;
}
return !stateInbox ? 0 : stateInbox.page_id;
},
// Get current FB Page ID link
linkToMessage() {
return `https://m.me/${this.getPageId}`;
},
getReadMessages() {
const chat = this.getMessages;
return chat === undefined ? null : this.readMessages(chat);

View File

@@ -121,12 +121,7 @@ export default {
currentChat: 'getSelectedChat',
}),
channelType() {
const {
meta: {
sender: { channel },
},
} = this.currentChat;
return channel;
return this.currentChat.meta.channel;
},
conversationType() {
const { additional_attributes: additionalAttributes } = this.currentChat;
@@ -145,10 +140,7 @@ export default {
return 10000;
},
showFileUpload() {
return (
this.channelType === 'Channel::WebWidget' ||
this.channelType === 'Channel::TwilioSms'
);
return this.channelType === 'Channel::WebWidget';
},
replyButtonLabel() {
if (this.isPrivate) {