feat: Assignable agents API (#2131)

`inboxes/id/assignable_agents` returns all users that have permission to a conversation happening in that inbox.
This commit is contained in:
Sojan Jose
2021-04-20 13:46:20 +05:30
committed by GitHub
parent fb582614f2
commit 4635e5bb44
5 changed files with 46 additions and 0 deletions

View File

@@ -7,6 +7,10 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
@inboxes = policy_scope(Current.account.inboxes.order_by_name.includes(:channel, { avatar_attachment: [:blob] }))
end
def assignable_agents
@assignable_agents = (Current.account.users.where(id: @inbox.members.select(:user_id)) + Current.account.administrators).uniq
end
def create
ActiveRecord::Base.transaction do
channel = create_channel