fix: keep agent bot takeover guard human-only
This commit is contained in:
@@ -74,7 +74,7 @@ class Api::V1::Accounts::Conversations::MessagesController < Api::V1::Accounts::
|
||||
end
|
||||
|
||||
def ensure_agent_bot_takeover
|
||||
return unless Current.user && @conversation.assignee_agent_bot_id.present?
|
||||
return unless Current.user.is_a?(User) && @conversation.assignee_agent_bot_id.present?
|
||||
return if private_message? || incoming_message?
|
||||
|
||||
render json: { error: 'Conversation is assigned to an Agent Bot. Take over the conversation before replying.' }, status: :unprocessable_entity
|
||||
|
||||
@@ -42,9 +42,8 @@ const assignedAgent = computed({
|
||||
},
|
||||
});
|
||||
|
||||
const isUserTyping = computed(
|
||||
() => props.message !== '' && !props.isOnPrivateNote
|
||||
);
|
||||
const hasMessage = computed(() => props.message !== '');
|
||||
const isUserTyping = computed(() => hasMessage.value && !props.isOnPrivateNote);
|
||||
const isUnassigned = computed(() => !assignedAgent.value);
|
||||
const isAssignedToOtherAgent = computed(
|
||||
() => assignedAgent.value?.id !== currentUser.value?.id
|
||||
@@ -58,7 +57,7 @@ const showSelfAssignBanner = computed(() => {
|
||||
|
||||
const showBotHandoffBanner = computed(() => {
|
||||
return (
|
||||
isUserTyping.value && currentChat.value?.meta?.assignee_type === 'AgentBot'
|
||||
hasMessage.value && currentChat.value?.meta?.assignee_type === 'AgentBot'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user