fix: preserve explicit assignee for bot inbox conversations
This commit is contained in:
@@ -296,6 +296,8 @@ class Conversation < ApplicationRecord
|
||||
end
|
||||
|
||||
def assign_connected_agent_bot
|
||||
return if assignee_id.present?
|
||||
|
||||
self.assignee = nil
|
||||
self.assignee_agent_bot = inbox.agent_bot
|
||||
end
|
||||
|
||||
@@ -663,6 +663,14 @@ RSpec.describe Conversation do
|
||||
expect(conversation.assignee).to be_nil
|
||||
end
|
||||
|
||||
it 'preserves explicit human assignee' do
|
||||
agent = create(:user, account: bot_inbox.inbox.account)
|
||||
conversation = create(:conversation, inbox: bot_inbox.inbox, assignee: agent)
|
||||
|
||||
expect(conversation.assignee).to eq(agent)
|
||||
expect(conversation.assignee_agent_bot).to be_nil
|
||||
end
|
||||
|
||||
context 'with campaigns' do
|
||||
let(:user) { create(:user, account: bot_inbox.inbox.account) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user