Bugfix: Use server timestamp to set agent_last_seen_at (#1114)

This commit is contained in:
Pranav Raj S
2020-08-03 13:40:20 +05:30
committed by GitHub
parent 941272cccd
commit 3b23aa7913
12 changed files with 62 additions and 26 deletions

View File

@@ -44,9 +44,8 @@ class Api::V1::Accounts::ConversationsController < Api::V1::Accounts::BaseContro
end
def update_last_seen
@conversation.agent_last_seen_at = parsed_last_seen_at
@conversation.agent_last_seen_at = DateTime.now.utc
@conversation.save!
head :ok
end
private
@@ -56,10 +55,6 @@ class Api::V1::Accounts::ConversationsController < Api::V1::Accounts::BaseContro
Rails.configuration.dispatcher.dispatch(event, Time.zone.now, conversation: @conversation, user: user)
end
def parsed_last_seen_at
DateTime.strptime(params[:agent_last_seen_at].to_s, '%s')
end
def conversation
@conversation ||= Current.account.conversations.find_by(display_id: params[:id])
end