feat: Agent bot cant assign conversations to teams (#8015)

Implemented so that the API can process priority and agent/team changes per Agent Bot.

Fixes:  #7474

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
giquieu
2024-02-12 07:21:22 -03:00
committed by GitHub
parent 5036b28e45
commit 227d99934e
6 changed files with 104 additions and 4 deletions

View File

@@ -1,7 +1,8 @@
module AccessTokenAuthHelper
BOT_ACCESSIBLE_ENDPOINTS = {
'api/v1/accounts/conversations' => %w[toggle_status create],
'api/v1/accounts/conversations/messages' => ['create']
'api/v1/accounts/conversations' => %w[toggle_status toggle_priority create],
'api/v1/accounts/conversations/messages' => ['create'],
'api/v1/accounts/conversations/assignments' => ['create']
}.freeze
def ensure_access_token

View File

@@ -25,6 +25,6 @@ module EnsureCurrentAccountHelper
end
def account_accessible_for_bot?(account)
render_unauthorized('You are not authorized to access this account') unless @resource.agent_bot_inboxes.find_by(account_id: account.id)
render_unauthorized('Bot is not authorized to access this account') unless @resource.agent_bot_inboxes.find_by(account_id: account.id)
end
end