Skip to content

Commit a47a14c

Browse files
authored
Removing First and Last name (#2997)
1 parent 3760a6b commit a47a14c

File tree

36 files changed

+37
-326
lines changed

36 files changed

+37
-326
lines changed

authentication/pipeline/user_test.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ def mock_create_user_strategy(mocker):
6868
"password": "password1",
6969
"username": "custom-username",
7070
"legal_address": {
71-
"first_name": "Jane",
72-
"last_name": "Doe",
7371
"country": "US",
7472
"state": "US-MA",
7573
},
@@ -344,8 +342,6 @@ def test_create_user_via_email_with_shorter_name(mocker, mock_email_backend):
344342
"password": "password1",
345343
"username": "custom-username",
346344
"legal_address": {
347-
"first_name": "Jane",
348-
"last_name": "Doe",
349345
"country": "US",
350346
},
351347
}
@@ -589,7 +585,6 @@ def test_create_ol_oidc_user( # noqa: PLR0913
589585
}
590586
details = {
591587
**base_details,
592-
"first_name": "Test",
593588
"fullname": "Test Admin",
594589
"last_name": "Admin",
595590
"profile": {

b2b/management/commands/b2b_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def handle_list_learners(self, *args, **kwargs): # noqa: ARG002
364364
for learner in learners:
365365
learners_table.add_row(
366366
learner.email,
367-
f"{learner.first_name} {learner.last_name}",
367+
f"{learner.name}",
368368
)
369369
self.console.print(learners_table)
370370

ecommerce/mail_api.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ def send_ecommerce_order_receipt(order_record):
5151
},
5252
"receipt": receipt,
5353
"purchaser": {
54-
"name": " ".join(
55-
[
56-
purchaser.get("first_name"),
57-
purchaser.get("last_name"),
58-
]
59-
),
54+
"name": purchaser.get("name"),
6055
"email": purchaser.get("email"),
6156
"street_address": purchaser.get("street_address"),
6257
"state_code": purchaser.get("state_or_territory").split("-")[

ecommerce/mail_api_test.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ def test_mail_api_receipt_generation( # noqa: PLR0913
5656

5757
rendered_template = mock_send_message.call_args[0][0]
5858

59-
assert (
60-
f"{order.purchaser.legal_address.first_name} {order.purchaser.legal_address.last_name}"
61-
in rendered_template.body
62-
)
59+
assert f"{order.purchaser.name}" in rendered_template.body
6360
assert order.reference_number in rendered_template.body
6461

6562
lines = order.lines.all()
@@ -90,9 +87,6 @@ def test_mail_api_refund_email_generation(
9087

9188
rendered_template = mock_send_message.call_args[0][0]
9289

93-
assert (
94-
f"{order.purchaser.legal_address.first_name} {order.purchaser.legal_address.last_name}"
95-
in rendered_template.body
96-
)
90+
assert f"{order.purchaser.name}" in rendered_template.body
9791
assert order.reference_number in rendered_template.body
9892
assert str(refund_amount.quantize(Decimal("0.01"))) in rendered_template.body

ecommerce/serializers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,7 @@ def to_representation(self, instance):
722722
transaction = super().to_representation(instance).data
723723

724724
fields = {
725-
"first_name": instance.purchaser.legal_address.first_name,
726-
"last_name": instance.purchaser.legal_address.last_name,
725+
"name": instance.purchaser.name,
727726
"country": instance.purchaser.legal_address.country,
728727
"email": instance.purchaser.email,
729728
"street_address": [],

ecommerce/serializers_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ def get_test_order_data(order, receipt_data):
299299
"reference_number": order.reference_number,
300300
},
301301
"purchaser": {
302-
"first_name": order.purchaser.legal_address.first_name,
303-
"last_name": order.purchaser.legal_address.last_name,
302+
"name": order.purchaser.name,
304303
"email": order.purchaser.email,
305304
"country": order.purchaser.legal_address.country,
306305
"state_or_territory": "",

ecommerce/templates/mail/order_refund_message/body.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
88
<tr>
99
<td style="padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">
10-
<p style="margin: 0 0 10px;">Dear {{ order.purchaser.legal_address.first_name }} {{ order.purchaser.legal_address.last_name }},</p>
10+
<p style="margin: 0 0 10px;">Dear {{ order.purchaser.name }},</p>
1111
<p style="margin: 0 0 10px;">
1212
We've processed your request for a refund of order {{order.reference_number}}. You should receive your credit in the amount of ${{transaction_amount}} for the course {{readable_id}} {{title}} within 5-10 business days.</p>
1313

fixtures/common.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ def mock_context(mocker, user):
8686
def valid_address_dict():
8787
"""Yields a dict that will deserialize into a valid legal address"""
8888
return dict( # noqa: C408
89-
first_name="Test",
90-
last_name="User",
9189
country="US",
9290
state="US-MA",
9391
)
@@ -97,8 +95,6 @@ def valid_address_dict():
9795
def invalid_address_dict():
9896
"""Yields a dict that will deserialize into an invalid US legal address"""
9997
return dict( # noqa: C408
100-
first_name="Test",
101-
last_name="User",
10298
country="US",
10399
state="XX",
104100
)
@@ -108,8 +104,6 @@ def invalid_address_dict():
108104
def address_no_state_dict():
109105
"""Yields a dict that will deserialize into a US legal address with no state"""
110106
return dict( # noqa: C408
111-
first_name="Test",
112-
last_name="User",
113107
country="US",
114108
state=None,
115109
)
@@ -120,7 +114,6 @@ def intl_address_dict():
120114
"""Yields a dict that will deserialize into an valid non-US/CA legal address"""
121115

122116
return dict( # noqa: C408
123-
first_name="Test",
124117
last_name="User",
125118
country="JP",
126119
)

flexiblepricing/mail_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def generate_flexible_price_email(flexible_price):
6262
flexible_price.user.email,
6363
{
6464
"subject": subject,
65-
"first_name": flexible_price.user.legal_address.first_name,
65+
"first_name": flexible_price.user.name,
6666
"message": message,
6767
"program_name": program_name,
6868
},
@@ -83,7 +83,7 @@ def send_financial_assistance_request_denied_email(
8383
financial_assistance_request.user.email,
8484
{
8585
"subject": email_subject,
86-
"first_name": financial_assistance_request.user.legal_address.first_name,
86+
"first_name": financial_assistance_request.user.name,
8787
"message": email_body,
8888
"program_name": financial_assistance_request.courseware_object.title,
8989
},

flexiblepricing/templates/mail/flexible_price/body.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block content %}
44
<br>
55
<div style="text-align: left; font-weight: normal; margin: 0 0 20px;">
6-
<p>Dear {{ first_name }},</p>
6+
<p>Dear {{ name }},</p>
77
<p>{{ message }}</p>
88
<p>Thank you,<br> "The {{program_name}} MITxOnline team"</p>
99
</div>

0 commit comments

Comments
 (0)