Skip to content

Commit

Permalink
MNTOR-3840 - Action needed tab (#5366)
Browse files Browse the repository at this point in the history
* fix: GitHub Slack Action

* Import translations from l10n repository (2024-12-04)

* fix: Condition for showing the email resent indicator

* fix

* update status pill

* Show congratulatory strinng

* fix tests

* rename var

* fix build error

* fix build

* fix build errors

* add storybook component

* add onerepscanresult id

* removal removal under maintenance in status for scan result

* ignore tests for now

* fix

* update status pill

* Show congratulatory strinng

* fix tests

* rename var

* fix build error

* fix build

* fix build errors

* add storybook component

* add onerepscanresult id

* removal removal under maintenance in status for scan result

* ignore tests for now

* fix diverged branch

* use nullish operator instead

* fix diverged branch

* fix diverged branch

* fix diverged branch

* fix diverged branch

* rmv console log

* fix e2e test

* revert some statuspill changes

* update direct type

* update direct type

* rebase fix

* rebase fix

* feat: add scan results brokers without filtering (#5375)

* Integration of getScanResultsWithBroker (#5391)

* Integration of getScanResultsWithBroker

* fix testS

* use getLatestOnerepScanResults for emails

* fix testS

* fix tests

* use faker and deprecate

* chore: Readd mock createRandomScanResult comment

* chore: Add additional unit tests RemovalUnderMaintenanceView

* chore: Remove c8 comment

* chore: Handle expected error for fetchWithDelay

* fix: Dashboard top banner state

* fix: Only join scan results with broker status for Premium users

---------

Co-authored-by: Florian Zia <[email protected]>
Co-authored-by: mozilla-pontoon <[email protected]>
Co-authored-by: mansaj <[email protected]>
  • Loading branch information
4 people authored Dec 11, 2024
1 parent 72deba3 commit 6b7ae5a
Show file tree
Hide file tree
Showing 50 changed files with 775 additions and 593 deletions.
11 changes: 9 additions & 2 deletions src/apiMocks/mockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { faker } from "@faker-js/faker";
import { OnerepScanResultRow } from "knex/types/tables";
import { OnerepScanResultDataBrokerRow } from "knex/types/tables";
import {
RemovalStatus,
RemovalStatusMap,
Expand All @@ -20,6 +20,7 @@ import {
import { Session } from "next-auth";
import { HibpLikeDbBreach } from "../utils/hibp";
import { SerializedSubscriber } from "../next-auth";
import { DataBrokerRemovalStatus } from "../app/functions/universal/dataBroker";

// Setting this to a constant value produces the same result when the same methods
// with the same version of faker are called.
Expand All @@ -40,6 +41,7 @@ export type RandomScanResultOptions = Partial<{
fakerSeed: number;
status: RemovalStatus;
manually_resolved: boolean;
broker_status: DataBrokerRemovalStatus;
}>;

/**
Expand All @@ -50,7 +52,7 @@ export type RandomScanResultOptions = Partial<{
*/
export function createRandomScanResult(
options: RandomScanResultOptions = {},
): OnerepScanResultRow {
): OnerepScanResultDataBrokerRow {
faker.seed(options.fakerSeed);
const optout_attempts =
options.status === "waiting_for_verification"
Expand Down Expand Up @@ -85,6 +87,11 @@ export function createRandomScanResult(
created_at: options.createdDate ?? faker.date.recent({ days: 2 }),
updated_at: faker.date.recent({ days: 1 }),
optout_attempts,
broker_status: options.broker_status ?? "active",
scan_result_status: faker.helpers.arrayElement(
Object.values(RemovalStatusMap),
) as RemovalStatus,
url: faker.internet.url(),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { getDashboardSummary } from "../../../../../functions/server/dashboard";
import { getSubscriberBreaches } from "../../../../../functions/server/getSubscriberBreaches";
import { getCountryCode } from "../../../../../functions/server/getCountryCode";
import { headers } from "next/headers";
import { getLatestOnerepScanResults } from "../../../../../../db/tables/onerep_scans";
import { FirstDataBrokerRemovalFixed } from "../../../../../../emails/templates/firstDataBrokerRemovalFixed/FirstDataBrokerRemovalFixed";
import {
createRandomHibpListing,
Expand All @@ -40,6 +39,7 @@ import { hasPremium } from "../../../../../functions/universal/user";
import { isEligibleForPremium } from "../../../../../functions/universal/premium";
import { MonthlyActivityFreeEmail } from "../../../../../../emails/templates/monthlyActivityFree/MonthlyActivityFreeEmail";
import { getMonthlyActivityFreeUnsubscribeLink } from "../../../../../../app/functions/cronjobs/unsubscribeLinks";
import { getScanResultsWithBroker } from "../../../../../../db/tables/onerep_scans";

async function getAdminSubscriber(): Promise<SubscriberRow | null> {
const session = await getServerSession();
Expand Down Expand Up @@ -140,8 +140,9 @@ export async function triggerMonthlyActivityFree(emailAddress: string) {
if (typeof subscriber.onerep_profile_id === "number") {
await refreshStoredScanResults(subscriber.onerep_profile_id);
}
const latestScan = await getLatestOnerepScanResults(
const latestScan = await getScanResultsWithBroker(
subscriber.onerep_profile_id,
hasPremium(session.user),
);
const data = getDashboardSummary(
latestScan.results,
Expand Down Expand Up @@ -178,8 +179,9 @@ export async function triggerMonthlyActivityPlus(emailAddress: string) {
if (typeof subscriber.onerep_profile_id === "number") {
await refreshStoredScanResults(subscriber.onerep_profile_id);
}
const latestScan = await getLatestOnerepScanResults(
const latestScan = await getScanResultsWithBroker(
subscriber.onerep_profile_id,
hasPremium(session.user),
);
const data = getDashboardSummary(
latestScan.results,
Expand Down Expand Up @@ -217,8 +219,9 @@ export async function triggerBreachAlert(
if (typeof subscriber.onerep_profile_id === "number") {
await refreshStoredScanResults(subscriber.onerep_profile_id);
}
const scanData = await getLatestOnerepScanResults(
const scanData = await getScanResultsWithBroker(
subscriber.onerep_profile_id,
hasPremium(session.user),
);
const allSubscriberBreaches = await getSubscriberBreaches({
fxaUid: subscriber.fxa_uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,6 @@ const OnerepConfigPage = (props: Props) => {
<option value="new">New</option>
<option value="optout_in_progress">In Progress</option>
<option value="removed">Removed</option>
<option value="removal_under_maintenance">
Removal under maintenance
</option>
</select>
</label>

Expand Down
Loading

0 comments on commit 6b7ae5a

Please sign in to comment.