Merged in feature/IO-3182-Phone-Number-Consent (pull request #2325)

Feature/IO-3182 Phone Number Consent
This commit is contained in:
Dave Richer
2025-05-21 19:17:52 +00:00
5 changed files with 29 additions and 12 deletions

View File

@@ -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 = <TimeAgoFormatter>{item.updated_at}</TimeAgoFormatter>;
const cardContentLeft =
@@ -91,7 +88,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
const cardExtra = (
<>
<Badge count={item.messages_aggregate.aggregate.count} />
{hasOptOutEntry && !isOptedOut && <Tag color="red">{t("messaging.labels.no_consent")}</Tag>}
{hasOptOutEntry && <Tag color="red">{t("messaging.labels.no_consent")}</Tag>}
</>
);

View File

@@ -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) => <TimeAgoFormatter>{text}</TimeAgoFormatter>
title: t("consent.created_at"),
dataIndex: "created_at",
render: (text) => <TimeAgoFormatter>{text}</TimeAgoFormatter>,
sorter: (a, b) => new Date(a.created_at) - new Date(b.created_at)
}
];
@@ -55,7 +56,7 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {
<Table
columns={columns}
dataSource={data?.phone_number_consent}
dataSource={data?.phone_number_opt_out}
loading={loading}
rowKey="id"
style={{ marginTop: 16 }}