Skip to content

Commit

Permalink
Remove all code relating to the legacy tenant app. (#1631)
Browse files Browse the repository at this point in the history
Hooray!  This fixes #1625 and removes all our code related to the legacy tenants app, since we decommissioned it on August 3.  In particular, it means the removal of the `legacy_tenants` Django app, and the removal of `pymongo` as a dependency.  It also deprecates the `prefersLegacyApp` GraphQL field (it will always be `null`), because we don't want out-of-date front-ends crashing if they ask for it.
  • Loading branch information
toolness authored Aug 13, 2020
1 parent 96c0f84 commit 04abb96
Show file tree
Hide file tree
Showing 53 changed files with 189 additions and 1,683 deletions.
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ psycopg2-binary = "==2.8.4"
graphene-django = "==2.4.0"
graphene = "==2.1.3"
graphql-core = "==2.2.1"
pymongo = "==3.7.1"
pydantic = "==0.17"
requests = "==2.20.0"
urllib3 = "==1.24.2"
Expand Down
322 changes: 136 additions & 186 deletions Pipfile.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/initial_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def create_initial_props_for_lambda(
'batchGraphQLURL': reverse('batch-graphql'),
'finishedLocPdfURL': reverse('finished_loc_pdf'),
'enableSafeModeURL': reverse('safe_mode:enable'),
'redirectToLegacyAppURL': reverse('redirect-to-legacy-app'),
'navbarLabel': settings.NAVBAR_LABEL,
'wowOrigin': settings.WOW_ORIGIN,
'efnycOrigin': settings.EFNYC_ORIGIN,
Expand Down
12 changes: 10 additions & 2 deletions frontend/lib/analytics/amplitude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ export type JustfixAmplitudeUserProperties = {
state: USStateChoice;
signupIntent: SignupIntent;
leaseType: LeaseChoice;
prefersLegacyApp: boolean | null;
isEmailVerified: boolean;
hasSentNorentLetter: boolean;
hasFiledEHPA: boolean;
issueCount: number;

/**
* This field is no longer relevant since we decomissioned the
* legacy app, but we're keeping it around in the type definition
* for documentation purposes. It was used to track whether the
* user wanted to be redirected to the legacy tenants app instead
* of the new one.
*/
prefersLegacyApp: boolean | null;
};

type PageInfo = {
Expand Down Expand Up @@ -78,7 +86,7 @@ function getUserPropertiesFromSession(
(s.onboardingInfo?.leaseType as LeaseChoice) ??
s.onboardingStep3?.leaseType ??
undefined,
prefersLegacyApp: s.prefersLegacyApp,
prefersLegacyApp: null,
isEmailVerified: s.isEmailVerified ?? undefined,
hasSentNorentLetter: !!s.norentLatestLetter,
hasFiledEHPA: s.emergencyHpActionSigningStatus === "SIGNED",
Expand Down
6 changes: 0 additions & 6 deletions frontend/lib/app-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ export interface AppServerInfo {
/** The POST endpoint to enable compatibility mode (aka "safe mode"). */
enableSafeModeURL: string;

/**
* The URL that automatically logs-in the current user to the legacy tenant
* app and redirects them there.
*/
redirectToLegacyAppURL: string;

/**
* An optional label to show the site's navbar.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export function getRouteForAccountStatus(
return routes.verifyPassword;
case PhoneNumberAccountStatus.ACCOUNT_WITHOUT_PASSWORD:
return routes.verifyPhoneNumber;
case PhoneNumberAccountStatus.LEGACY_TENANTS_ACCOUNT:
return routes.migrateLegacyTenantsUser;
}
}

Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion frontend/lib/norent/start-account-or-login/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export function createStartAccountOrLoginRouteInfo(prefix: string) {
return {
phoneNumber: `${prefix}/phone/ask`,
phoneNumberTermsModal: `${prefix}/phone/ask/terms-modal`,
migrateLegacyTenantsUser: `${prefix}/migrate-legacy-tenants-user`,
verifyPhoneNumber: `${prefix}/phone/verify`,
setPassword: `${prefix}/password/set`,
verifyPassword: `${prefix}/password/verify`,
Expand Down
6 changes: 0 additions & 6 deletions frontend/lib/norent/start-account-or-login/steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { SetPassword } from "./set-password";
import { VerifyPhoneNumber } from "./verify-phone-number";
import { isUserLoggedIn } from "../../util/session-predicates";
import { assertNotNull } from "../../util/util";
import { MigrateLegacyTenantsUser } from "./migrate-legacy-tenants-user";

export type StartAccountOrLoginProps = MiddleProgressStepProps & {
routes: StartAccountOrLoginRouteInfo;
Expand Down Expand Up @@ -43,11 +42,6 @@ export function createStartAccountOrLoginSteps(
shouldBeSkipped: isUserLoggedIn,
render: wrap(AskPhoneNumber),
},
{
path: routes.migrateLegacyTenantsUser,
shouldBeSkipped: isUserLoggedInOrCreatingNewAccount,
render: wrap(MigrateLegacyTenantsUser),
},
{
path: routes.verifyPassword,
shouldBeSkipped: isUserLoggedInOrCreatingNewAccount,
Expand Down
19 changes: 0 additions & 19 deletions frontend/lib/norent/start-account-or-login/tests/steps.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { PasswordResetVerificationCodeMutation } from "../../../queries/Password
import { PasswordResetConfirmAndLoginMutation } from "../../../queries/PasswordResetConfirmAndLoginMutation";
import { LoginMutation } from "../../../queries/LoginMutation";
import { PasswordResetMutation } from "../../../queries/PasswordResetMutation";
import { PrepareLegacyTenantsAccountForMigrationMutation } from "../../../queries/PrepareLegacyTenantsAccountForMigrationMutation";

const routes = createStartAccountOrLoginRouteInfo("");

Expand Down Expand Up @@ -110,24 +109,6 @@ describe("start-account-or-login flow", () => {
pal.ensureLinkGoesTo(/back/i, "/phone/ask");
});

it("if account is a legacy user, 'migrates' them", async () => {
const pal = startFlow(PhoneNumberAccountStatus.LEGACY_TENANTS_ACCOUNT);

await pal.waitForLocation("/migrate-legacy-tenants-user");
pal.ensureLinkGoesTo(/back/i, "/phone/ask");
pal.clickButtonOrLink(/create/i);
pal
.withFormMutation(PrepareLegacyTenantsAccountForMigrationMutation)
.expect({})
.respondWithSuccess({
session: pal.sessionBuilder.withQueriedPhoneNumber(
PhoneNumberAccountStatus.NO_ACCOUNT
).value,
});

await pal.waitForLocation("/done");
});

it("if account has no password, verifies phone, then sets password", async () => {
const pal = startFlow(PhoneNumberAccountStatus.ACCOUNT_WITHOUT_PASSWORD);

Expand Down
10 changes: 1 addition & 9 deletions frontend/lib/pages/login-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { NextButton } from "../ui/buttons";
import { RouteComponentProps } from "react-router";
import { withAppContext, AppContextType, AppContext } from "../app-context";
import { PhoneNumberFormField } from "../forms/phone-number-form-field";
import { assertNotNull } from "../util/util";
import { getPostOrQuerystringVar } from "../util/querystring";
import { Link } from "react-router-dom";
import { getPostOnboardingURL } from "../onboarding/signup-intent";
Expand All @@ -20,7 +19,6 @@ import {

export interface LoginFormProps {
next: string;
redirectToLegacyAppURL: string;
}

export class LoginForm extends React.Component<LoginFormProps> {
Expand All @@ -30,9 +28,6 @@ export class LoginForm extends React.Component<LoginFormProps> {
mutation={LoginMutation}
initialState={BlankLoginInput}
onSuccessRedirect={(output, input) => {
if (assertNotNull(output.session).prefersLegacyApp) {
return this.props.redirectToLegacyAppURL;
}
return this.props.next;
}}
performRedirect={performHardOrSoftRedirect}
Expand Down Expand Up @@ -72,10 +67,7 @@ const LoginPage = withAppContext(
<Page title="Sign in">
<div className="box">
<h1 className="title">Sign in</h1>
<LoginForm
next={next}
redirectToLegacyAppURL={props.server.redirectToLegacyAppURL}
/>
<LoginForm next={next} />
<br />
<div className="content">
<p>
Expand Down
2 changes: 0 additions & 2 deletions frontend/lib/queries/autogen-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ createBlankLiteral = true
fragmentName = "DDOSuggestionsResult"
createBlankLiteral = true

[mutations.prepareLegacyTenantsAccountForMigration]

[mutations.agreeToTerms]
sessionFields = ["onboardingInfo"]

Expand Down
1 change: 0 additions & 1 deletion frontend/lib/queries/autogen/AllSessionInfo.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ fragment AllSessionInfo on SessionInfo {
trackingNumber,
letterSentAt
},
prefersLegacyApp,
issues,
customIssuesV2 {
id,
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion frontend/lib/tests/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const FakeServerInfo: Readonly<AppServerInfo> = {
wowOrigin: "https://wow.test",
efnycOrigin: "https://efnyc.test",
enableSafeModeURL: "/mysafemode/enable",
redirectToLegacyAppURL: "/myredirect-to-legacy-app",
mapboxAccessToken: "",
enabledLocales: ["en"],
enableWipLocales: false,
Expand Down
Empty file removed legacy_tenants/__init__.py
Empty file.
11 changes: 0 additions & 11 deletions legacy_tenants/admin.py

This file was deleted.

5 changes: 0 additions & 5 deletions legacy_tenants/apps.py

This file was deleted.

103 changes: 0 additions & 103 deletions legacy_tenants/auth.py

This file was deleted.

Empty file.
Empty file.
Loading

0 comments on commit 04abb96

Please sign in to comment.