feat: Rewrite conversations mixin to a helper (#9931)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getLastMessage } from 'dashboard/helper/conversationHelper';
|
||||
import Thumbnail from '../Thumbnail.vue';
|
||||
import MessagePreview from './MessagePreview.vue';
|
||||
import conversationMixin from '../../../mixins/conversations';
|
||||
import router from '../../../routes';
|
||||
import { frontendURL, conversationUrl } from '../../../helper/URLHelper';
|
||||
import InboxName from '../InboxName.vue';
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
PriorityMark,
|
||||
SLACardLabel,
|
||||
},
|
||||
mixins: [inboxMixin, conversationMixin],
|
||||
mixins: [inboxMixin],
|
||||
props: {
|
||||
activeLabel: {
|
||||
type: String,
|
||||
@@ -118,7 +118,7 @@ export default {
|
||||
},
|
||||
|
||||
lastMessageInChat() {
|
||||
return this.lastMessage(this.chat);
|
||||
return getLastMessage(this.chat);
|
||||
},
|
||||
|
||||
inbox() {
|
||||
|
||||
@@ -13,9 +13,6 @@ import Banner from 'dashboard/components/ui/Banner.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
// mixins
|
||||
import conversationMixin, {
|
||||
filterDuplicateSourceMessages,
|
||||
} from '../../../mixins/conversations';
|
||||
import inboxMixin, { INBOX_FEATURES } from 'shared/mixins/inboxMixin';
|
||||
import configMixin from 'shared/mixins/configMixin';
|
||||
import aiMixin from 'dashboard/mixins/aiMixin';
|
||||
@@ -24,6 +21,11 @@ import aiMixin from 'dashboard/mixins/aiMixin';
|
||||
import { getTypingUsersText } from '../../../helper/commons';
|
||||
import { calculateScrollTop } from './helpers/scrollTopCalculationHelper';
|
||||
import { LocalStorage } from 'shared/helpers/localStorage';
|
||||
import {
|
||||
filterDuplicateSourceMessages,
|
||||
getReadMessages,
|
||||
getUnreadMessages,
|
||||
} from 'dashboard/helper/conversationHelper';
|
||||
|
||||
// constants
|
||||
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
||||
@@ -38,7 +40,7 @@ export default {
|
||||
Banner,
|
||||
ConversationLabelSuggestion,
|
||||
},
|
||||
mixins: [conversationMixin, inboxMixin, configMixin, aiMixin],
|
||||
mixins: [inboxMixin, configMixin, aiMixin],
|
||||
props: {
|
||||
isContactPanelOpen: {
|
||||
type: Boolean,
|
||||
@@ -138,14 +140,14 @@ export default {
|
||||
}
|
||||
return messages;
|
||||
},
|
||||
getReadMessages() {
|
||||
return this.readMessages(
|
||||
readMessages() {
|
||||
return getReadMessages(
|
||||
this.getMessages,
|
||||
this.currentChat.agent_last_seen_at
|
||||
);
|
||||
},
|
||||
getUnReadMessages() {
|
||||
return this.unReadMessages(
|
||||
unReadMessages() {
|
||||
return getUnreadMessages(
|
||||
this.getMessages,
|
||||
this.currentChat.agent_last_seen_at
|
||||
);
|
||||
@@ -468,7 +470,7 @@ export default {
|
||||
</li>
|
||||
</transition>
|
||||
<Message
|
||||
v-for="message in getReadMessages"
|
||||
v-for="message in readMessages"
|
||||
:key="message.id"
|
||||
class="message--read ph-no-capture"
|
||||
data-clarity-mask="True"
|
||||
@@ -493,7 +495,7 @@ export default {
|
||||
</span>
|
||||
</li>
|
||||
<Message
|
||||
v-for="message in getUnReadMessages"
|
||||
v-for="message in unReadMessages"
|
||||
:key="message.id"
|
||||
class="message--unread ph-no-capture"
|
||||
data-clarity-mask="True"
|
||||
|
||||
Reference in New Issue
Block a user