Skip to content

Commit 12db30c

Browse files
committed
feat(local_units): Update email context for dev preview email notifications
1 parent a714f3b commit 12db30c

File tree

3 files changed

+58
-12
lines changed

3 files changed

+58
-12
lines changed

local_units/dev_views.py

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,65 @@ class LocalUnitsEmailPreview(APIView):
99

1010
def get(self, request):
1111
type_param = request.GET.get("type")
12-
param_types = {"new", "update", "validate", "revert", "deprecate", "regional_validator", "global_validator"}
12+
param_types = {
13+
"new",
14+
"update",
15+
"validate",
16+
"revert",
17+
"deprecate",
18+
"regional_validator",
19+
"global_validator",
20+
}
1321

1422
if type_param not in param_types:
15-
return HttpResponse(f"Invalid type parameter. Please use one of the following values: {', '.join(param_types)}.")
23+
return HttpResponse(f"Invalid 'type' parameter. Please use one of the following values: {', '.join(param_types)}.")
1624

1725
context_mapping = {
18-
"new": {"new_local_unit": True, "validator_email": "Test Validator", "full_name": "Test User"},
19-
"update": {"update_local_unit": True, "validator_email": "Test Validator", "full_name": "Test User"},
20-
"validate": {"validate_success": True, "full_name": "Test User"},
21-
"revert": {"revert_reason": "Test Reason", "full_name": "Test User"},
22-
"deprecate": {"deprecate_local_unit": True, "deprecate_reason": "Test Deprecate Reason", "full_name": "Test User"},
23-
"regional_validator": {"is_validator_regional_admin": True, "full_name": "Regional User"},
24-
"global_validator": {"is_validator_global_admin": True, "full_name": "Global User"},
26+
"new": {
27+
"new_local_unit": True,
28+
"validator_email": "Test Validator",
29+
"full_name": "Test User",
30+
"country": "Test Country",
31+
},
32+
"update": {
33+
"update_local_unit": True,
34+
"update_reason_overview": "Test update reason",
35+
"validator_email": "Test Validator",
36+
"full_name": "Test User",
37+
"country": "Test Country",
38+
"country_id": 1,
39+
},
40+
"validate": {
41+
"validate_success": True,
42+
"full_name": "Test User",
43+
"country": "Test Country",
44+
"country_id": 1,
45+
},
46+
"revert": {
47+
"revert_reason": "Test Reason",
48+
"full_name": "Test User",
49+
"country": "Test Country",
50+
"country_id": 1,
51+
},
52+
"deprecate": {
53+
"deprecate_local_unit": True,
54+
"deprecate_reason": "Test Deprecate Reason",
55+
"full_name": "Test User",
56+
"country": "Test Country",
57+
"country_id": 1,
58+
},
59+
"regional_validator": {
60+
"is_validator_regional_admin": True,
61+
"full_name": "Regional User",
62+
"country": "Test Country",
63+
"country_id": 1,
64+
},
65+
"global_validator": {
66+
"is_validator_global_admin": True,
67+
"full_name": "Global User",
68+
"country": "Test Country",
69+
"country_id": 1,
70+
},
2571
}
2672

2773
context = context_mapping.get(type_param)

notifications/templates/design/foot1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</td>
1313
{% if not hide_preferences %}
1414
<td class="text-default td-smaller-font-style pl-10 pr-10" style="color: #000000;font-family:'Lato', Arial, sans-serif;font-size: 16px;padding-left: 10px;padding-right: 10px;">
15-
<a href="https://go.ifrc.org/account#notifications" target="_blank" class="link" style="font-family: 'Lato', Arial, sans-serif;text-decoration: underline;color: #000;">Unsubscribe</a>
15+
<a href="{{ frontend_url }}/account#notifications" target="_blank" class="link" style="font-family: 'Lato', Arial, sans-serif;text-decoration: underline;color: #000;">Unsubscribe</a>
1616
</td>
1717
{% endif %}
1818
</tr>

notifications/templates/design/foot2.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
<table width="100%" border="0" cellspacing="0" cellpadding="0">
99
<tr>
1010
<td class="text-default td-smaller-font-style text-right pl-10 pr-10" style="color: #000000;font-family:'Lato', Arial, sans-serif;border-right:1px solid #000;font-size: 16px;text-align: right;padding-left: 10px;padding-right: 10px;">
11-
<a href="{{ frontend_url }}/login" target="_blank" class="link" style="font-family: 'Lato', Arial, sans-serif;text-decoration: underline;color: #000;">Login to IFRC GO</a>
11+
<a href="{{ frontend_url }}/login" target="_blank" class="link" style="font-family: 'Lato', Arial, sans-serif;text-decoration: underline;color: #000;">Login to IFRC GO</a>
1212
</td>
1313
{% if not hide_preferences %}
1414
<td class="text-default td-smaller-font-style pl-10 pr-10" style="color: #000000;font-family:'Lato', Arial, sans-serif;font-size: 16px;padding-left: 10px;padding-right: 10px;">
15-
<a href="{{ frontend_url }}/account#notifications" target="_blank" class="link" style="font-family: 'Lato', Arial, sans-serif;text-decoration: underline;color: #000;">Unsubscribe</a>
15+
<a href="{{ frontend_url }}/account#notifications" target="_blank" class="link" style="font-family: 'Lato', Arial, sans-serif;text-decoration: underline;color: #000;">Unsubscribe</a>
1616
</td>
1717
{% endif %}
1818
</tr>

0 commit comments

Comments
 (0)