Feature: Api to toggle typing status on a conversation (#807)
- api to toggle typing status on a conversation - clients receive webhook events on the same Addresses: #718 , #719 , #775
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class Api::V1::Accounts::ConversationsController < Api::BaseController
|
||||
include Events::Types
|
||||
before_action :conversation, except: [:index]
|
||||
before_action :contact_inbox, only: [:create]
|
||||
|
||||
@@ -23,6 +24,16 @@ class Api::V1::Accounts::ConversationsController < Api::BaseController
|
||||
@status = @conversation.toggle_status
|
||||
end
|
||||
|
||||
def toggle_typing_status
|
||||
user = current_user.presence || @resource
|
||||
if params[:typing_status] == 'on'
|
||||
Rails.configuration.dispatcher.dispatch(CONVERSATION_TYPING_ON, Time.zone.now, conversation: @conversation, user: user)
|
||||
elsif params[:typing_status] == 'off'
|
||||
Rails.configuration.dispatcher.dispatch(CONVERSATION_TYPING_OFF, Time.zone.now, conversation: @conversation)
|
||||
end
|
||||
head :ok
|
||||
end
|
||||
|
||||
def update_last_seen
|
||||
@conversation.agent_last_seen_at = parsed_last_seen_at
|
||||
@conversation.save!
|
||||
|
||||
Reference in New Issue
Block a user