From 5c9765ec3190934d11c51f563819d09bd1f7ed00 Mon Sep 17 00:00:00 2001 From: Sojan Date: Wed, 9 Mar 2022 02:55:56 +0530 Subject: [PATCH] chore: participation tab --- app/finders/conversation_finder.rb | 2 ++ .../dashboard/components/ChatList.vue | 3 +++ .../config/sidebarItems/conversations.js | 9 +++++++++ app/javascript/dashboard/helper/URLHelper.js | 3 +++ .../dashboard/i18n/locale/en/settings.json | 1 + .../conversation/conversation.routes.js | 19 +++++++++++++++++++ app/models/user.rb | 1 + 7 files changed, 38 insertions(+) diff --git a/app/finders/conversation_finder.rb b/app/finders/conversation_finder.rb index 58013f128..3d8e4e7a9 100644 --- a/app/finders/conversation_finder.rb +++ b/app/finders/conversation_finder.rb @@ -73,6 +73,8 @@ class ConversationFinder if params[:conversation_type] == 'mention' conversation_ids = current_account.mentions.where(user: current_user).pluck(:conversation_id) @conversations = current_account.conversations.where(id: conversation_ids) + elsif params[:conversation_type] == 'participating' + @conversations = current_user.participating_conversations.where(account_id: current_account.id) else @conversations = current_account.conversations.where(inbox_id: @inbox_ids) end diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index deb0276bf..ee3b27703 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -300,6 +300,9 @@ export default { if (this.conversationType === 'mention') { return this.$t('CHAT_LIST.MENTION_HEADING'); } + if (this.conversationType === 'participating') { + return 'Participating'; + } if (this.hasActiveFolders) { return this.activeFolder.name; } diff --git a/app/javascript/dashboard/components/layout/config/sidebarItems/conversations.js b/app/javascript/dashboard/components/layout/config/sidebarItems/conversations.js index 596fdd8d1..8288beedc 100644 --- a/app/javascript/dashboard/components/layout/config/sidebarItems/conversations.js +++ b/app/javascript/dashboard/components/layout/config/sidebarItems/conversations.js @@ -14,6 +14,8 @@ const conversations = accountId => ({ 'conversations_through_team', 'conversation_mentions', 'conversation_through_mentions', + 'conversation_participating', + 'conversation_through_participating', 'folder_conversations', 'conversations_through_folders', ], @@ -33,6 +35,13 @@ const conversations = accountId => ({ toState: frontendURL(`accounts/${accountId}/mentions/conversations`), toStateName: 'conversation_mentions', }, + { + icon: 'people-team', + label: 'PARTICIPATING_CONVERSATIONS', + key: 'conversation_participating', + toState: frontendURL(`accounts/${accountId}/participating/conversations`), + toStateName: 'conversation_participating', + }, ], }); diff --git a/app/javascript/dashboard/helper/URLHelper.js b/app/javascript/dashboard/helper/URLHelper.js index 583a99c7c..335bf07b7 100644 --- a/app/javascript/dashboard/helper/URLHelper.js +++ b/app/javascript/dashboard/helper/URLHelper.js @@ -38,6 +38,9 @@ export const conversationUrl = ({ } else if (conversationType === 'mention') { url = `accounts/${accountId}/mentions/conversations/${id}`; } + else if (conversationType === 'participating') { + url = `accounts/${accountId}/participating/conversations/${id}`; + } return url; }; diff --git a/app/javascript/dashboard/i18n/locale/en/settings.json b/app/javascript/dashboard/i18n/locale/en/settings.json index 5727e09d0..f5d5c1923 100644 --- a/app/javascript/dashboard/i18n/locale/en/settings.json +++ b/app/javascript/dashboard/i18n/locale/en/settings.json @@ -146,6 +146,7 @@ "CONVERSATIONS": "Conversations", "ALL_CONVERSATIONS": "All Conversations", "MENTIONED_CONVERSATIONS": "Mentions", + "PARTICIPATING_CONVERSATIONS": "Participating", "REPORTS": "Reports", "SETTINGS": "Settings", "CONTACTS": "Contacts", diff --git a/app/javascript/dashboard/routes/dashboard/conversation/conversation.routes.js b/app/javascript/dashboard/routes/dashboard/conversation/conversation.routes.js index ebd219a2f..811d0b91b 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/conversation.routes.js +++ b/app/javascript/dashboard/routes/dashboard/conversation/conversation.routes.js @@ -121,5 +121,24 @@ export default { conversationType: 'mention', }), }, + { + path: frontendURL('accounts/:accountId/participating/conversations'), + name: 'conversation_participating', + roles: ['administrator', 'agent'], + component: ConversationView, + props: () => ({ conversationType: 'participating' }), + }, + { + path: frontendURL( + 'accounts/:accountId/participating/conversations/:conversationId' + ), + name: 'conversation_through_participating', + roles: ['administrator', 'agent'], + component: ConversationView, + props: route => ({ + conversationId: route.params.conversationId, + conversationType: 'participating', + }), + }, ], }; diff --git a/app/models/user.rb b/app/models/user.rb index 64d9c6710..960f5aacf 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -77,6 +77,7 @@ class User < ApplicationRecord alias_attribute :conversations, :assigned_conversations has_many :csat_survey_responses, foreign_key: 'assigned_agent_id', dependent: :nullify has_many :conversation_participants, dependent: :destroy_async + has_many :participating_conversations, through: :conversation_participants, source: :conversation has_many :inbox_members, dependent: :destroy_async has_many :inboxes, through: :inbox_members, source: :inbox