From edcbd534258d93f02a35c1c2888ff95dd5635c02 Mon Sep 17 00:00:00 2001 From: Clairton Rodrigo Heinzen Date: Tue, 29 Nov 2022 09:51:37 -0300 Subject: [PATCH] feat: Read/Delivery status for Whatsapp Cloud API (#5157) Process field statuses received in webhook WhatsApp cloud API ref: #1021 Co-authored-by: Sojan Co-authored-by: Nithin David <1277421+nithindavid@users.noreply.github.com> --- .../widgets/conversation/Message.vue | 9 +++ .../widgets/conversation/MessagesView.vue | 2 + .../widgets/conversation/bubble/Actions.vue | 77 +++++++++++++++---- .../dashboard/i18n/locale/en/chatlist.json | 2 + app/javascript/shared/constants/messages.js | 2 + app/models/message.rb | 3 +- .../whatsapp/incoming_message_base_service.rb | 29 ++++++- .../api/v1/models/_message.json.jbuilder | 1 + .../whatsapp/incoming_message_service_spec.rb | 40 ++++++++++ 9 files changed, 148 insertions(+), 17 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/Message.vue b/app/javascript/dashboard/components/widgets/conversation/Message.vue index 44d28fc52..35dec8322 100644 --- a/app/javascript/dashboard/components/widgets/conversation/Message.vue +++ b/app/javascript/dashboard/components/widgets/conversation/Message.vue @@ -59,10 +59,12 @@ :story-sender="storySender" :story-id="storyId" :is-a-tweet="isATweet" + :is-a-whatsapp-channel="isAWhatsAppChannel" :has-instagram-story="hasInstagramStory" :is-email="isEmailContentType" :is-private="data.private" :message-type="data.message_type" + :message-status="status" :readable-time="readableTime" :source-id="data.source_id" :inbox-id="data.inbox_id" @@ -157,6 +159,10 @@ export default { type: Boolean, default: false, }, + isAWhatsAppChannel: { + type: Boolean, + default: false, + }, hasInstagramStory: { type: Boolean, default: false, @@ -231,6 +237,9 @@ export default { sender() { return this.data.sender || {}; }, + status() { + return this.data.status; + }, storySender() { return this.contentAttributes.story_sender || null; }, diff --git a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue index aefa7774a..0ebe35465 100644 --- a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue +++ b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue @@ -38,6 +38,7 @@ class="message--read ph-no-capture" :data="message" :is-a-tweet="isATweet" + :is-a-whatsapp-channel="isAWhatsAppChannel" :has-instagram-story="hasInstagramStory" :has-user-read-message=" hasUserReadMessage(message.created_at, getLastSeenAt) @@ -60,6 +61,7 @@ class="message--unread ph-no-capture" :data="message" :is-a-tweet="isATweet" + :is-a-whatsapp-channel="isAWhatsAppChannel" :has-instagram-story="hasInstagramStory" :has-user-read-message=" hasUserReadMessage(message.created_at, getLastSeenAt) diff --git a/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue b/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue index e9df39f49..67b7e6a05 100644 --- a/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue +++ b/app/javascript/dashboard/components/widgets/conversation/bubble/Actions.vue @@ -3,20 +3,30 @@ {{ readableTime }} - + + + + + + + -