From 0541afceb8855511160fcc74944f3b42b4862f93 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Wed, 21 May 2025 15:17:11 -0400 Subject: [PATCH] feature/IO-3182-Phone-Number-Consent - Checkpoint --- .../chat-conversation-list.component.jsx | 5 +---- .../phone-number-consent.component.jsx | 9 +++++---- .../graphql/phone-number-opt-out.queries.js | 6 +++--- client/src/translations/en_us/common.json | 2 +- hasura/metadata/tables.yaml | 19 +++++++++++++++++++ 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx b/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx index 70bfc5b5d..8bf185756 100644 --- a/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx +++ b/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx @@ -62,10 +62,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation, const renderConversation = (index, t) => { const item = sortedConversationList[index]; const normalizedPhone = phone(item.phone_num, "CA").phoneNumber.replace(/^\+1/, ""); - // Check if the phone number exists in the consentMap const hasOptOutEntry = optOutMap.has(normalizedPhone); - // Only consider it non-consented if it exists and consent_status is false - const isOptedOut = hasOptOutEntry ? optOutMap.get(normalizedPhone) : true; const cardContentRight = {item.updated_at}; const cardContentLeft = @@ -91,7 +88,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation, const cardExtra = ( <> - {hasOptOutEntry && !isOptedOut && {t("messaging.labels.no_consent")}} + {hasOptOutEntry && {t("messaging.labels.no_consent")}} ); diff --git a/client/src/components/phone-number-consent/phone-number-consent.component.jsx b/client/src/components/phone-number-consent/phone-number-consent.component.jsx index fa0f810c0..020bb1750 100644 --- a/client/src/components/phone-number-consent/phone-number-consent.component.jsx +++ b/client/src/components/phone-number-consent/phone-number-consent.component.jsx @@ -39,9 +39,10 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) { sorter: (a, b) => a.phone_number.localeCompare(b.phone_number) }, { - title: t("consent.updated_at"), - dataIndex: "consent_updated_at", - render: (text) => {text} + title: t("consent.created_at"), + dataIndex: "created_at", + render: (text) => {text}, + sorter: (a, b) => new Date(a.created_at) - new Date(b.created_at) } ]; @@ -55,7 +56,7 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {