Skip to content

Commit

Permalink
Rename 'fullname' vars to 'legalname' to reduce confusion w/ preferre…
Browse files Browse the repository at this point in the history
…d name (#2066)

* Rename all 'fullname' vars to 'legalname' to reduce confusion once we add preferred first name.

* Deprecate the old fullname mutation

* Remove unused constant

* Added two legacy tests and changed capitalization of comments
  • Loading branch information
samaratrilling authored May 3, 2021
1 parent 71c2649 commit 866aaf8
Show file tree
Hide file tree
Showing 62 changed files with 381 additions and 146 deletions.
2 changes: 1 addition & 1 deletion airtable/tests/test_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

@pytest.mark.django_db
def test_from_user_works_with_minimal_user():
user = UserFactory(phone_number="5551234567", full_name="Bobby Denver")
user = UserFactory(phone_number="5551234567", full_legal_name="Bobby Denver")
fields = Fields.from_user(user)
assert fields.pk == user.pk
assert fields.first_name == "Bobby"
Expand Down
4 changes: 3 additions & 1 deletion airtable/tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def test_multiple_rows_with_same_pk_are_logged():

@pytest.mark.django_db
def test_airtable_synchronizer_works():
user = UserFactory.create(full_name="Boop Jones", phone_number="5551234567", username="boop")
user = UserFactory.create(
full_legal_name="Boop Jones", phone_number="5551234567", username="boop"
)

airtable = FakeAirtable()
syncer = AirtableSynchronizer(airtable)
Expand Down
2 changes: 1 addition & 1 deletion evictionfree/hardship_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ def get_vars_for_user(user: JustfixUser) -> Optional[HardshipDeclarationVariable
address=", ".join(onb.address_lines_for_mailing),
has_financial_hardship=hdd.has_financial_hardship,
has_health_risk=hdd.has_health_risk,
name=user.full_name,
name=user.full_legal_name,
date=date.today().strftime("%m/%d/%Y"),
)
2 changes: 1 addition & 1 deletion evictionfree/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ class SubmittedHardshipDeclaration(models.Model, SendableViaLobMixin):
def __str__(self):
if not self.pk:
return super().__str__()
return f"{self.user.full_name}'s hardship declaration"
return f"{self.user.full_legal_name}'s hardship declaration"
4 changes: 2 additions & 2 deletions frontend/lib/account-settings/about-you-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AppContext } from "../app-context";
import { TextualFormField } from "../forms/form-fields";
import { SessionUpdatingFormSubmitter } from "../forms/session-updating-form-submitter";
import { li18n } from "../i18n-lingui";
import { NorentFullNameMutation } from "../queries/NorentFullNameMutation";
import { NorentFullLegalNameMutation } from "../queries/NorentFullLegalNameMutation";
import { EditableInfo, SaveCancelButtons } from "../ui/editable-info";
import { makeAccountSettingsSection, WithAccountSettingsProps } from "./util";

Expand All @@ -23,7 +23,7 @@ const NameField: React.FC<WithAccountSettingsProps> = ({ routes }) => {
path={routes.name}
>
<SessionUpdatingFormSubmitter
mutation={NorentFullNameMutation}
mutation={NorentFullLegalNameMutation}
initialState={(s) => ({
firstName: s.firstName || "",
lastName: s.lastName || "",
Expand Down
14 changes: 9 additions & 5 deletions frontend/lib/admin/admin-conversations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ const ConversationsSidebar: React.FC<{
>
<div className="jf-heading">
<div className="jf-tenant">
{conv.userFullName ||
{conv.userFullLegalName ||
friendlyPhoneNumber(conv.userPhoneNumber)}{" "}
{conv.errorMessage && "❌"}
</div>
Expand Down Expand Up @@ -367,7 +367,7 @@ const ConversationMessages: React.FC<{
return <>{elements}</>;
};

function getUserFullName(user: AdminConversation_userDetails): string {
function getUserFullLegalName(user: AdminConversation_userDetails): string {
return [user.firstName, user.lastName].join(" ").trim();
}

Expand All @@ -382,7 +382,7 @@ const ConversationPanel: React.FC<{
};
const convMsgs = conversation.value?.output?.messages || [];
const user = conversation.value?.userDetails;
const userFullName = user ? getUserFullName(user) : "";
const userFullLegalName = user ? getUserFullLegalName(user) : "";

return (
<div className="jf-current-conversation">
Expand All @@ -398,10 +398,14 @@ const ConversationPanel: React.FC<{
>
<h1>
Conversation with{" "}
{userFullName || friendlyPhoneNumber(selectedPhoneNumber)}
{userFullLegalName ||
friendlyPhoneNumber(selectedPhoneNumber)}
</h1>
{user ? (
<AdminUserInfo showPhoneNumber={!!userFullName} user={user} />
<AdminUserInfo
showPhoneNumber={!!userFullLegalName}
user={user}
/>
) : (
<p>
This phone number does not seem to have an account with us.
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/admin/admin-directory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import Page from "../ui/page";
import { SimpleProgressiveEnhancement } from "../ui/progressive-enhancement";
import { assertNotUndefined } from "@justfixnyc/util";
import { adminGetUserFullName, AdminUserInfo } from "./admin-user-info";
import { adminGetUserFullLegalName, AdminUserInfo } from "./admin-user-info";
import { staffOnlyView } from "./staff-only-view";

type UserDetails = AdminUserSearch_output;
Expand All @@ -34,7 +34,7 @@ const UserSearchHelpers: SearchAutocompleteHelpers<
getIncompleteItem: (text) => ({ text }),
searchResultsToItems: (results) => {
return results.map((user) => ({
text: `${adminGetUserFullName(user)} ${user.phoneNumber}`,
text: `${adminGetUserFullLegalName(user)} ${user.phoneNumber}`,
fullDetails: user,
}));
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/admin/admin-user-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const EhpaAttorneyAssigned: React.FC<{ rapidproGroups: string[] }> = (
}
};

export function adminGetUserFullName(user: {
export function adminGetUserFullLegalName(user: {
firstName: string;
lastName: string;
}): string {
Expand All @@ -49,7 +49,7 @@ export const AdminUserInfo: React.FC<{
showPhoneNumber: boolean;
showName?: boolean;
}> = ({ user, showPhoneNumber, showName }) => {
const name = adminGetUserFullName(user);
const name = adminGetUserFullLegalName(user);
return (
<>
{showName && name && <p>This user's name is {name}.</p>}
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/admin/frontapp-plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
FrontappUserDetails,
FrontappUserDetailsVariables,
} from "../queries/FrontappUserDetails";
import { adminGetUserFullName, AdminUserInfo } from "./admin-user-info";
import { adminGetUserFullLegalName, AdminUserInfo } from "./admin-user-info";
import Page from "../ui/page";
import { AdminAuthExpired } from "./admin-auth-expired";
import { AdminDirectoryWidget } from "./admin-directory";
Expand Down Expand Up @@ -73,7 +73,7 @@ const LoadedUserInfo: React.FC<
return (
<>
<div className="content">
<h1>{adminGetUserFullName(userDetails)}</h1>
<h1>{adminGetUserFullLegalName(userDetails)}</h1>
<AdminUserInfo user={userDetails} showPhoneNumber />
<hr />
<p>
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/admin/tests/admin-conversations.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe("<AdminConversationsPage>", () => {
messages: [
{
userPhoneNumber: "+15551234567",
userFullName: "Boop Jones",
userFullLegalName: "Boop Jones",
userId: 5,
...BASE_MESSAGE,
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/common-steps/ask-name.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Page from "../ui/page";
import { SessionUpdatingFormSubmitter } from "../forms/session-updating-form-submitter";
import { NorentFullNameMutation } from "../queries/NorentFullNameMutation";
import { NorentFullLegalNameMutation } from "../queries/NorentFullLegalNameMutation";
import { TextualFormField } from "../forms/form-fields";
import { ProgressButtons } from "../ui/buttons";
import { li18n } from "../i18n-lingui";
Expand All @@ -18,7 +18,7 @@ export const AskNameStep: React.FC<MiddleProgressStepProps> = (props) => {
</div>
<br />
<SessionUpdatingFormSubmitter
mutation={NorentFullNameMutation}
mutation={NorentFullLegalNameMutation}
initialState={(s) => ({
firstName: s.norentScaffolding?.firstName || s.firstName || "",
lastName: s.norentScaffolding?.lastName || s.lastName || "",
Expand Down
19 changes: 10 additions & 9 deletions frontend/lib/evictionfree/declaration-email-to-housing-court.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
sessionToEvictionFreeDeclarationEmailProps,
} from "./declaration-email-utils";

export const EvictionFreeEmailDisclaimer: React.FC<{ fullName: string }> = ({
fullName,
}) => (
export const EvictionFreeEmailDisclaimer: React.FC<{
fullLegalName: string;
}> = ({ fullLegalName }) => (
<small>
Note: {fullName} is submitting the attached Hardship Declaration to the
Note: {fullLegalName} is submitting the attached Hardship Declaration to the
Court using this JustFix.nyc email address. This email address is used
solely for the purpose of submitting the Hardship Declaration and receiving
confirmation of its receipt. This email address is not the Declarant's own
Expand All @@ -29,7 +29,7 @@ function emailSubject(options: EvictionFreeDeclarationEmailProps): string {

// This is a very specific subject line format, outlined here:
// http://www.nycourts.gov/eefpa/PDF/HardshipDeclarationCopy-1.8.pdf
const parts = [options.fullName, options.address];
const parts = [options.fullLegalName, options.address];

if (options.indexNumber) {
parts.push(`No. ${options.indexNumber}`);
Expand Down Expand Up @@ -57,9 +57,10 @@ export const EvictionFreeDeclarationEmailToHousingCourtStaticPage = asEmailStati
<HtmlEmail subject={emailSubject(props)}>
<p>Hello Court Clerk,</p>
<p>
Attached you will find the Hardship Declaration of {props.fullName}{" "}
submitted by them pursuant to the COVID-19 Emergency Eviction and
Foreclosure Prevention Act of 2020 on {props.dateSubmitted}.
Attached you will find the Hardship Declaration of{" "}
{props.fullLegalName} submitted by them pursuant to the COVID-19
Emergency Eviction and Foreclosure Prevention Act of 2020 on{" "}
{props.dateSubmitted}.
</p>
{props.indexNumber && (
<p>
Expand All @@ -74,7 +75,7 @@ export const EvictionFreeDeclarationEmailToHousingCourtStaticPage = asEmailStati
</p>
)}
<p>Thank you,</p>
<p>{props.fullName}</p>
<p>{props.fullLegalName}</p>
<br />
<EvictionFreeEmailDisclaimer {...props} />
</HtmlEmail>
Expand Down
6 changes: 3 additions & 3 deletions frontend/lib/evictionfree/declaration-email-to-landlord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const EvictionFreeDeclarationEmailToLandlordStaticPage = asEmailStaticPag
<HtmlEmail subject={evictionFreeDeclarationEmailFormalSubject(props)}>
<p>Hello {props.landlordName},</p>
<p>
Attached you will find the Hardship Declaration for {props.fullName}{" "}
completed on {props.dateSubmitted}.
Attached you will find the Hardship Declaration for{" "}
{props.fullLegalName} completed on {props.dateSubmitted}.
</p>
<p>
With this declaration, {props.firstName} is protected from eviction
Expand All @@ -28,7 +28,7 @@ export const EvictionFreeDeclarationEmailToLandlordStaticPage = asEmailStaticPag
proof of completion.
</p>
<p>Thank you,</p>
<p>{props.fullName}</p>
<p>{props.fullLegalName}</p>
<br />
<EvictionFreeEmailDisclaimer {...props} />
</HtmlEmail>
Expand Down
6 changes: 3 additions & 3 deletions frontend/lib/evictionfree/declaration-email-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { friendlyUTCDate } from "../util/date-util";

export type EvictionFreeDeclarationEmailProps = {
firstName: string;
fullName: string;
fullLegalName: string;
landlordName: string;
dateSubmitted: string;
trackingNumber: string;
Expand All @@ -30,7 +30,7 @@ export function sessionToEvictionFreeDeclarationEmailProps(

return {
firstName: s.firstName,
fullName: `${s.firstName} ${s.lastName}`,
fullLegalName: `${s.firstName} ${s.lastName}`,
landlordName: ld.name,
dateSubmitted: friendlyUTCDate(shd.createdAt),
indexNumber: hdd?.indexNumber ?? "",
Expand All @@ -48,7 +48,7 @@ export function sessionToEvictionFreeDeclarationEmailProps(
export function evictionFreeDeclarationEmailFormalSubject(
options: EvictionFreeDeclarationEmailProps
): string {
const parts = ["Hardship Declaration", options.fullName];
const parts = ["Hardship Declaration", options.fullLegalName];

if (options.indexNumber) {
parts.push(`Index #: ${options.indexNumber}`);
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/loc/letter-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const LetterConclusion: React.FC<LocContentProps> = (props) => (
<letter.Regards>
<br />
<br />
<letter.FullName {...props} />
<letter.FullLegalName {...props} />
</letter.Regards>
</div>
</>
Expand Down
12 changes: 6 additions & 6 deletions frontend/lib/norent/letter-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const NorentLetterTranslation: React.FC<{}> = () => {
<LetterBody {...props} />
<letter.Signed />
<p>
<letter.FullName {...props} />
<letter.FullLegalName {...props} />
</p>
</>
)}
Expand All @@ -113,19 +113,19 @@ export const NorentLetterEmailToLandlord: React.FC<BaseLetterContentProps> = (
<>
<EmailSubject
value={li18n._(
t`Notice of COVID-19 impact on Rent sent on behalf of ${letter.getFullName(
t`Notice of COVID-19 impact on Rent sent on behalf of ${letter.getFullLegalName(
props
)}`
)}
/>
<letter.DearLandlord {...props} />
<Trans id="norent.emailToLandlordBody_v2">
<p>
Please see letter attached from <letter.FullName {...props} />.{" "}
Please see letter attached from <letter.FullLegalName {...props} />.{" "}
</p>
<p>
In order to document communications and avoid misunderstandings, please
correspond with <letter.FullName {...props} /> via email at{" "}
correspond with <letter.FullLegalName {...props} /> via email at{" "}
<span style={{ textDecoration: "underline" }}>{props.email}</span> or
mail rather than a phone call or in-person visit.
</p>
Expand All @@ -134,7 +134,7 @@ export const NorentLetterEmailToLandlord: React.FC<BaseLetterContentProps> = (
<p>
<Trans>
NoRent.org <br />
sent on behalf of <letter.FullName {...props} />
sent on behalf of <letter.FullLegalName {...props} />
</Trans>
</p>
</>
Expand Down Expand Up @@ -349,7 +349,7 @@ export const NorentLetterContent: React.FC<NorentLetterContentProps> = (
<letter.Signed>
<br />
<br />
<letter.FullName {...props} />
<letter.FullLegalName {...props} />
</letter.Signed>
</div>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fragment LatestTextMessagesResult on LatestTextMessagesResult {
body,
errorMessage,
userPhoneNumber,
userFullName,
userFullLegalName,
userId
},
hasNextPage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto-generated by querybuilder, please do not edit it.
mutation NorentFullNameMutation($input: NorentFullNameInput!) {
output: norentFullName(input: $input) {
mutation NorentFullLegalNameMutation($input: NorentFullLegalNameInput!) {
output: norentFullLegalName(input: $input) {
errors { ...ExtendedFormFieldErrors },
session { ...AllSessionInfo }
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/lib/rh/email-to-dhcr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ function getEmailInfo(s: AllSessionInfo) {
if (!rh) return null;

const { apartmentNumber } = rh;
const fullName = `${rh.firstName} ${rh.lastName}`;
const fullLegalName = `${rh.firstName} ${rh.lastName}`;
const borough = getBoroughChoiceLabels()[rh.borough as BoroughChoice];
const fullAddress = `${rh.address}, ${borough} ${rh.zipcode}`.trim();

return { fullName, fullAddress, apartmentNumber };
return { fullLegalName, fullAddress, apartmentNumber };
}

export const RhEmailToDhcr: React.FC<{}> = () => {
Expand All @@ -36,14 +36,14 @@ export const RhEmailToDhcr: React.FC<{}> = () => {
<Trans id="justfix.rhRequestToDhcr">
<p>DHCR administrator,</p>
<p>
I, {i.fullName}, am currently living at {i.fullAddress} in
I, {i.fullLegalName}, am currently living at {i.fullAddress} in
apartment {i.apartmentNumber}, and would like to request the
complete Rent History for this apartment back to the year 1984.
</p>
<p>
Thank you,
<br />
{i.fullName}
{i.fullLegalName}
</p>
</Trans>
</>
Expand Down
Loading

0 comments on commit 866aaf8

Please sign in to comment.