chore: participation tab

This commit is contained in:
Sojan 2022-03-09 02:55:56 +05:30
parent cef897fae2
commit 5c9765ec31
7 changed files with 38 additions and 0 deletions

View file

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

View file

@ -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;
}

View file

@ -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',
},
],
});

View file

@ -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;
};

View file

@ -146,6 +146,7 @@
"CONVERSATIONS": "Conversations",
"ALL_CONVERSATIONS": "All Conversations",
"MENTIONED_CONVERSATIONS": "Mentions",
"PARTICIPATING_CONVERSATIONS": "Participating",
"REPORTS": "Reports",
"SETTINGS": "Settings",
"CONTACTS": "Contacts",

View file

@ -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',
}),
},
],
};

View file

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