feat: Rewrite conversations mixin to a helper (#9931)

This commit is contained in:
Sivin Varghese
2024-08-13 15:15:04 +05:30
committed by GitHub
parent c26490e9c1
commit b33d59d804
9 changed files with 395 additions and 394 deletions

View File

@@ -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"