feat: Add delivery reports for API channel (#8116)
This commit is contained in:
@@ -23,6 +23,7 @@ class Public::Api::V1::Inboxes::ConversationsController < Public::Api::V1::Inbox
|
|||||||
def update_last_seen
|
def update_last_seen
|
||||||
@conversation.contact_last_seen_at = DateTime.now.utc
|
@conversation.contact_last_seen_at = DateTime.now.utc
|
||||||
@conversation.save!
|
@conversation.save!
|
||||||
|
::Conversations::MarkMessagesAsReadJob.perform_later(@conversation)
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -214,8 +214,8 @@ export default {
|
|||||||
if (this.isAWhatsAppChannel || this.isATwilioChannel) {
|
if (this.isAWhatsAppChannel || this.isATwilioChannel) {
|
||||||
return this.sourceId && this.isDelivered;
|
return this.sourceId && this.isDelivered;
|
||||||
}
|
}
|
||||||
// We will consider messages as delivered for web widget inbox if they are sent
|
// We will consider messages as delivered for web widget inbox and API inbox if they are sent
|
||||||
if (this.isAWebWidgetInbox) {
|
if (this.isAWebWidgetInbox || this.isAPIInbox) {
|
||||||
return this.isSent;
|
return this.isSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ RSpec.describe 'Public Inbox Contact Conversations API', type: :request do
|
|||||||
|
|
||||||
it 'updates the last seen of the conversation contact' do
|
it 'updates the last seen of the conversation contact' do
|
||||||
contact_last_seen_at = conversation.contact_last_seen_at
|
contact_last_seen_at = conversation.contact_last_seen_at
|
||||||
|
expect(Conversations::MarkMessagesAsReadJob).to receive(:perform_later).with(conversation)
|
||||||
post update_last_seen_path
|
post update_last_seen_path
|
||||||
|
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
|
|||||||
Reference in New Issue
Block a user