Add status reopen activity message for api channel (#6839)
This commit is contained in:
@@ -32,7 +32,13 @@ module ActivityMessageHandler
|
||||
end
|
||||
|
||||
def send_automation_activity
|
||||
content = I18n.t("conversations.activity.status.#{status}", user_name: 'Automation System')
|
||||
content = if Current.executed_by.instance_of?(AutomationRule)
|
||||
I18n.t("conversations.activity.status.#{status}", user_name: 'Automation System')
|
||||
elsif Current.executed_by.instance_of?(Contact)
|
||||
Current.executed_by = nil
|
||||
I18n.t('conversations.activity.status.system_auto_open')
|
||||
end
|
||||
|
||||
::Conversations::ActivityMessageJob.perform_later(self, activity_message_params(content)) if content
|
||||
end
|
||||
|
||||
|
||||
@@ -257,11 +257,18 @@ class Message < ApplicationRecord
|
||||
# mark resolved bot conversation as pending to be reopened by bot processor service
|
||||
if conversation.inbox.active_bot?
|
||||
conversation.pending!
|
||||
elsif conversation.inbox.api?
|
||||
Current.executed_by = sender if reopened_by_contact?
|
||||
conversation.open!
|
||||
else
|
||||
conversation.open!
|
||||
end
|
||||
end
|
||||
|
||||
def reopened_by_contact?
|
||||
incoming? && !private? && Current.user.class != sender.class && sender.instance_of?(Contact)
|
||||
end
|
||||
|
||||
def execute_message_template_hooks
|
||||
::MessageTemplates::HookExecutionService.new(message: self).perform
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user