diff --git a/app/finders/conversation_finder.rb b/app/finders/conversation_finder.rb index f2641dde0..3409a2450 100644 --- a/app/finders/conversation_finder.rb +++ b/app/finders/conversation_finder.rb @@ -70,7 +70,12 @@ class ConversationFinder end def find_all_conversations - @conversations = current_account.conversations.where(inbox_id: @inbox_ids) + 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) + else + @conversations = current_account.conversations.where(inbox_id: @inbox_ids) + end end def filter_by_assignee_type @@ -123,6 +128,10 @@ class ConversationFinder @conversations = @conversations.includes( :taggings, :inbox, { assignee: { avatar_attachment: [:blob] } }, { contact: { avatar_attachment: [:blob] } }, :team, :contact_inbox ) - @conversations.latest.page(current_page) + if params[:conversation_type] == 'mention' + @conversations.page(current_page) + else + @conversations.latest.page(current_page) + end end end diff --git a/app/javascript/dashboard/api/inbox/conversation.js b/app/javascript/dashboard/api/inbox/conversation.js index 8fca2b83c..9f6b8baf1 100644 --- a/app/javascript/dashboard/api/inbox/conversation.js +++ b/app/javascript/dashboard/api/inbox/conversation.js @@ -6,7 +6,15 @@ class ConversationApi extends ApiClient { super('conversations', { accountScoped: true }); } - get({ inboxId, status, assigneeType, page, labels, teamId }) { + get({ + inboxId, + status, + assigneeType, + page, + labels, + teamId, + conversationType, + }) { return axios.get(this.url, { params: { inbox_id: inboxId, @@ -15,6 +23,7 @@ class ConversationApi extends ApiClient { assignee_type: assigneeType, page, labels, + conversation_type: conversationType, }, }); } @@ -74,7 +83,7 @@ class ConversationApi extends ApiClient { return axios.post(`${this.url}/${conversationId}/unmute`); } - meta({ inboxId, status, assigneeType, labels, teamId }) { + meta({ inboxId, status, assigneeType, labels, teamId, conversationType }) { return axios.get(`${this.url}/meta`, { params: { inbox_id: inboxId, @@ -82,6 +91,7 @@ class ConversationApi extends ApiClient { assignee_type: assigneeType, labels, team_id: teamId, + conversation_type: conversationType, }, }); } diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 1517105df..2abffb1c8 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -51,6 +51,7 @@ l