diff --git a/app/controllers/public/api/v1/inboxes/conversations_controller.rb b/app/controllers/public/api/v1/inboxes/conversations_controller.rb index c799523723d90..1e20b2a1dbe7f 100644 --- a/app/controllers/public/api/v1/inboxes/conversations_controller.rb +++ b/app/controllers/public/api/v1/inboxes/conversations_controller.rb @@ -23,6 +23,7 @@ def toggle_typing def update_last_seen @conversation.contact_last_seen_at = DateTime.now.utc @conversation.save! + ::Conversations::MarkMessagesAsReadJob.perform_later(@conversation) head :ok end diff --git a/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue b/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue index e03cc74edaa5e..f3c7e4f3cd801 100644 --- a/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue +++ b/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue @@ -214,8 +214,8 @@ export default { if (this.isAWhatsAppChannel || this.isATwilioChannel) { return this.sourceId && this.isDelivered; } - // We will consider messages as delivered for web widget inbox if they are sent - if (this.isAWebWidgetInbox) { + // We will consider messages as delivered for web widget inbox and API inbox if they are sent + if (this.isAWebWidgetInbox || this.isAPIInbox) { return this.isSent; } diff --git a/spec/controllers/public/api/v1/inbox/conversations_controller_spec.rb b/spec/controllers/public/api/v1/inbox/conversations_controller_spec.rb index 0bd8cbfd09e90..3001263bf77c3 100644 --- a/spec/controllers/public/api/v1/inbox/conversations_controller_spec.rb +++ b/spec/controllers/public/api/v1/inbox/conversations_controller_spec.rb @@ -81,6 +81,7 @@ it 'updates the last seen of the conversation contact' do contact_last_seen_at = conversation.contact_last_seen_at + expect(Conversations::MarkMessagesAsReadJob).to receive(:perform_later).with(conversation) post update_last_seen_path expect(response).to have_http_status(:success)