From fbd98dd88966dd052f69f60c4f98304d05953bd8 Mon Sep 17 00:00:00 2001 From: Kaitlyn Date: Thu, 16 Jan 2025 06:55:49 -0500 Subject: [PATCH] show the custom exposures in the removal under maintenace view --- .../removal-under-maintenance/page.tsx | 23 +++++++++++++++---- .../dashboard/getUserDashboardState.tsx | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/data-broker-profiles/removal-under-maintenance/page.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/data-broker-profiles/removal-under-maintenance/page.tsx index 36ff71aca0c..4e5857d5826 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/data-broker-profiles/removal-under-maintenance/page.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/data-broker-profiles/removal-under-maintenance/page.tsx @@ -11,6 +11,7 @@ import { import { getCountryCode } from "../../../../../../../../../functions/server/getCountryCode"; import { headers } from "next/headers"; import { + getMockedScanResults, getScanResultsWithBroker, getScanResultsWithBrokerUnderMaintenance, } from "../../../../../../../../../../db/tables/onerep_scans"; @@ -20,6 +21,7 @@ import { getSubscriberEmails } from "../../../../../../../../../functions/server import { RemovalUnderMaintenanceView } from "./RemovalUnderMaintenanceView"; import { hasPremium } from "../../../../../../../../../functions/universal/user"; import { getEnabledFeatureFlags } from "../../../../../../../../../../db/tables/featureFlags"; +import { getQaToggleRow } from "../../../../../../../../../../db/tables/qa_customs"; export default async function RemovalUnderMaintenance() { const session = await getServerSession(); @@ -64,19 +66,30 @@ export default async function RemovalUnderMaintenance() { "DataBrokerManualRemoval", ); - if ( - scansWithRemovalUnderMaintenance?.results.length === 0 || - !scansWithRemovalUnderMaintenance - ) { + const mockScanResultsData = await getMockedScanResults(profileId ?? 100); + const qaToggles = await getQaToggleRow(profileId); + let showCustomBrokers = false; + + if (qaToggles) { + showCustomBrokers = qaToggles.show_custom_brokers; + } + + const brokerData = showCustomBrokers + ? mockScanResultsData + : scansWithRemovalUnderMaintenance; + + if (brokerData?.results.length === 0 || !brokerData) { redirect(getNextStep.href); } + console.log({ brokerData }); + const subscriberEmails = await getSubscriberEmails(session.user); return ( diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/getUserDashboardState.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/getUserDashboardState.tsx index 70e01ca18da..30b5cf91c9a 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/getUserDashboardState.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/getUserDashboardState.tsx @@ -33,6 +33,7 @@ const isMatchingContent = ( ) => { const { hasExposures, hasUnresolvedBreaches, hasUnresolvedBrokers } = contentConditions; + // If a user does not have any exposures it’s also not possible to have unresolved ones. // This check is meant to avoid adding invalid conditions in `getUserDashboardState`. /* c8 ignore next 8 */