Skip to content

Commit d02fc93

Browse files
authored
Merge pull request #27 from moshthepitt/issue-26
Fix name in application emails
2 parents da41dd7 + e5bfb5f commit d02fc93

8 files changed

+14
-12
lines changed

small_small_hr/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Main init file for small_small_hr
33
"""
4-
VERSION = (0, 1, 5)
4+
VERSION = (0, 1, 6)
55
__version__ = '.'.join(str(v) for v in VERSION)
66
# pylint: disable=invalid-name
77
default_app_config = 'small_small_hr.apps.SmallSmallHrConfig' # noqa

small_small_hr/emails.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def leave_application_email(leave_obj: object):
6868

6969
for admin_email in admin_emails:
7070
send_email(
71-
name=leave_obj.staff.get_name(),
71+
name=settings.SSHR_ADMIN_NAME,
7272
email=admin_email,
7373
subject=subj,
7474
message=msg,
@@ -118,7 +118,7 @@ def overtime_application_email(overtime_obj: object):
118118

119119
for admin_email in admin_emails:
120120
send_email(
121-
name=overtime_obj.staff.get_name(),
121+
name=settings.SSHR_ADMIN_NAME,
122122
email=admin_email,
123123
subject=subj,
124124
message=msg,

small_small_hr/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
{'day': 26, 'month': 12}, # Boxing day
2626
] # these are days that are not counted when getting taken leave days
2727
# emails
28+
SSHR_ADMIN_NAME = "HR"
2829
SSHR_ADMIN_EMAILS = [settings.DEFAULT_FROM_EMAIL]
2930
SSHR_ADMIN_LEAVE_EMAILS = SSHR_ADMIN_EMAILS
3031
SSHR_ADMIN_OVERTIME_EMAILS = SSHR_ADMIN_EMAILS

small_small_hr/templates/small_small_hr/email/leave_application_email_body.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hello {{name}},<br/><br/>
1+
Hello,<br/><br/>
22
{{message|linebreaks}}
33
<br/><br/>
44
Thank you,<br/>

small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hello {{name}},
1+
Hello,
22

33
{{message}}
44

small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hello {{name}},<br/><br/>
1+
Hello,<br/><br/>
22
{{message|linebreaks}}
33
<br/><br/>
44
Thank you,<br/>

small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hello {{name}},
1+
Hello,
22

33
{{message}}
44

tests/test_emails.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
@override_settings(
2222
SSHR_ADMIN_EMAILS=["[email protected]"],
2323
SSHR_ADMIN_LEAVE_EMAILS=["[email protected]"],
24-
SSHR_ADMIN_OVERTIME_EMAILS=["[email protected]"]
24+
SSHR_ADMIN_OVERTIME_EMAILS=["[email protected]"],
25+
SSHR_ADMIN_NAME="mosh"
2526
)
2627
class TestEmails(TestCase):
2728
"""
@@ -55,7 +56,7 @@ def test_leave_application_email(self, mock):
5556
leave_application_email(leave)
5657

5758
mock.assert_called_with(
58-
name="Bob Ndoe",
59+
name="mosh",
5960
6061
subject="New Leave Application",
6162
message="There has been a new leave application. Please log in to process it.", # noqa
@@ -104,7 +105,7 @@ def test_overtime_application_email(self, mock):
104105
overtime_application_email(overtime)
105106

106107
mock.assert_called_with(
107-
name="Bob Ndoe",
108+
name="mosh",
108109
109110
subject="New Overtime Application",
110111
message="There has been a new overtime application. Please log in to process it.", # noqa
@@ -222,7 +223,7 @@ def test_send_email_templates(self, mock, site_mock):
222223
leave_application_email(leave)
223224

224225
context = dict(
225-
name="Bob Ndoe",
226+
name="mosh",
226227
subject="New Leave Application",
227228
message="There has been a new leave application. Please log in to process it.", # noqa
228229
object=leave,
@@ -260,7 +261,7 @@ def test_send_email_templates(self, mock, site_mock):
260261
overtime_application_email(overtime)
261262

262263
context = dict(
263-
name="Bob Ndoe",
264+
name="mosh",
264265
subject="New Overtime Application",
265266
message="There has been a new overtime application. Please log in to process it.", # noqa
266267
object=overtime,

0 commit comments

Comments
 (0)