feat: Add a view for mentions (#3505)

- Added a new table mentions for saving user mentions
- Added a filter conversation_type in the API
- Added a view to see the mentions
This commit is contained in:
Pranav Raj S
2021-12-08 21:50:14 -08:00
committed by GitHub
parent 1db82f235d
commit 2be71e73dc
28 changed files with 389 additions and 98 deletions

View File

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