@@ -28,16 +28,7 @@ import { renderEmail } from "../../emails/renderEmail";
2828import { BreachAlertEmail } from "../../emails/templates/breachAlert/BreachAlertEmail" ;
2929import { getCronjobL10n } from "../../app/functions/l10n/cronjobs" ;
3030import { sanitizeSubscriberRow } from "../../app/functions/server/sanitize" ;
31- import { getSubscriberBreaches } from "../../app/functions/server/getSubscriberBreaches" ;
3231import { getSignupLocaleCountry } from "../../emails/functions/getSignupLocaleCountry" ;
33- import { refreshStoredScanResults } from "../../app/functions/server/refreshStoredScanResults" ;
34- import { isEligibleForPremium } from "../../app/functions/universal/premium" ;
35- import { hasPremium } from "../../app/functions/universal/user" ;
36- import {
37- DashboardSummary ,
38- getDashboardSummary ,
39- } from "../../app/functions/server/dashboard" ;
40- import { getScanResultsWithBroker } from "../../db/tables/onerep_scans" ;
4132import { logger } from "../../app/functions/server/logging" ;
4233import { getExperimentationIdFromSubscriber } from "../../app/functions/server/getExperimentationId" ;
4334import { getExperiments } from "../../app/functions/server/getExperiments" ;
@@ -284,25 +275,6 @@ export async function poll(
284275 */
285276 const assumedCountryCode = getSignupLocaleCountry ( recipient ) ;
286277
287- // The unit tests are currently too complex for me to write
288- // a proper test for this, and I need to understand the code
289- // better to be able to refactor it to make it more amenable
290- // to simple tests. Hence, I don't have a test for this yet:
291- /* c8 ignore next 3 */
292- if ( typeof recipient . onerep_profile_id === "number" ) {
293- await refreshStoredScanResults ( recipient . onerep_profile_id ) ;
294- }
295-
296- const dataSummary : DashboardSummary | undefined =
297- // We currently need the data summary for the `<DataPointCount>` in
298- // `<BreachAlertEmail>`, which is only shown for free users who are
299- // eligible for Plus (i.e. are in the US) who have run a scan.
300- // Since it's somewhat expensive to run the queries to fetch this data,
301- // we only do it for those users.
302- isEligibleForPremium ( assumedCountryCode ) && ! hasPremium ( recipient )
303- ? await getDataSummary ( recipient , assumedCountryCode )
304- : undefined ;
305-
306278 const subject = l10n . getString ( "email-breach-alert-all-subject" ) ;
307279 const experimentationId =
308280 await getExperimentationIdFromSubscriber ( recipient ) ;
@@ -322,7 +294,7 @@ export async function poll(
322294 breachedEmail = { breachedEmail }
323295 utmCampaignId = { utmCampaignId }
324296 subscriber = { recipient }
325- dataSummary = { dataSummary }
297+ dataSummary = { undefined }
326298 experimentData = { experimentData [ "Features" ] }
327299 /> ,
328300 ) ,
@@ -380,21 +352,6 @@ export async function poll(
380352 }
381353}
382354
383- async function getDataSummary (
384- recipient : SubscriberRow | ( SubscriberRow & EmailAddressRow ) ,
385- assumedCountryCode : string ,
386- ) : Promise < DashboardSummary > {
387- const allSubscriberBreaches = await getSubscriberBreaches ( {
388- fxaUid : recipient . fxa_uid ,
389- countryCode : assumedCountryCode ,
390- } ) ;
391- const scanData = await getScanResultsWithBroker (
392- recipient . onerep_profile_id ,
393- hasPremium ( recipient ) ,
394- ) ;
395- return getDashboardSummary ( scanData . results , allSubscriberBreaches ) ;
396- }
397-
398355/* c8 ignore start */
399356export function createPubSubClient ( ) {
400357 let options = { } ;
0 commit comments