diff --git a/app/models/concerns/assignment_handler.rb b/app/models/concerns/assignment_handler.rb index 5e57d985c..a9f529f65 100644 --- a/app/models/concerns/assignment_handler.rb +++ b/app/models/concerns/assignment_handler.rb @@ -3,7 +3,7 @@ module AssignmentHandler include Events::Types included do - before_validation :ensure_assignee_is_from_team + before_save :ensure_assignee_is_from_team after_commit :notify_assignment_change, :process_assignment_changes end diff --git a/app/models/conversation.rb b/app/models/conversation.rb index 46f7bcf4e..a4672edac 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -66,7 +66,6 @@ class Conversation < ApplicationRecord validates :inbox_id, presence: true validates :contact_id, presence: true before_validation :validate_additional_attributes - before_validation :handle_agent_bot_takeover_by_assignee validates :additional_attributes, jsonb_attributes_length: true validates :custom_attributes, jsonb_attributes_length: true validates :uuid, uniqueness: true @@ -117,6 +116,7 @@ class Conversation < ApplicationRecord has_many :attachments, through: :messages has_many :reporting_events, dependent: :destroy_async + before_save :handle_agent_bot_takeover_by_assignee before_save :ensure_snooze_until_reset before_create :determine_conversation_status before_create :ensure_waiting_since