From 4c6572c2c98870117d91df8646a70e2018839a99 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:41:12 +0530 Subject: [PATCH] feat: Rewrite `conversation/labelMixin` to a composable (#9936) # Pull Request Template ## Description This PR will replace the usage of `conversation/labelMixin` with a composable Fixes https://linear.app/chatwoot/issue/CW-3439/rewrite-conversationlabelmixin-mixin-to-a-composable ## Type of change - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? **Test cases** 1. Add/remove labels from conversation sidebar 2. See labels are showing up dynamically 3. Check add/remove labels working fine with CMD bar 4. Check card labels in conversation card and SLA reports table. ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../widgets/conversation/ConversationCard.vue | 6 +- .../conversationCardComponents/CardLabels.vue | 33 +++--- .../spec/useConversationLabels.spec.js | 87 +++++++++++++++ app/javascript/dashboard/composables/store.js | 2 +- .../composables/useConversationLabels.js | 101 ++++++++++++++++++ .../mixins/conversation/labelMixin.js | 46 -------- .../routes/dashboard/commands/commandbar.vue | 19 +++- .../conversation/labels/LabelBox.vue | 26 ++--- .../reports/components/SLA/SLAReportItem.vue | 11 +- 9 files changed, 252 insertions(+), 79 deletions(-) create mode 100644 app/javascript/dashboard/composables/spec/useConversationLabels.spec.js create mode 100644 app/javascript/dashboard/composables/useConversationLabels.js delete mode 100644 app/javascript/dashboard/mixins/conversation/labelMixin.js diff --git a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue index 27994fc17..fc2b4d7b7 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue @@ -316,7 +316,11 @@ export default { {{ unreadCount > 9 ? '9+' : unreadCount }} - + diff --git a/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue b/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue index 885b59a78..39fd9e047 100644 --- a/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue +++ b/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue @@ -1,23 +1,26 @@