From 4b4bc0e892fa17016e91d1be7fea353647a55e77 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 23:41:00 +0300 Subject: [PATCH 1/5] Remove name from application email templates --- .../small_small_hr/email/leave_application_email_body.html | 2 +- .../small_small_hr/email/leave_application_email_body.txt | 2 +- .../small_small_hr/email/overtime_application_email_body.html | 2 +- .../small_small_hr/email/overtime_application_email_body.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html index 7fed0ef..f0d3095 100644 --- a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html +++ b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.html @@ -1,4 +1,4 @@ -Hello {{name}},

+Hello,

{{message|linebreaks}}

Thank you,
diff --git a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt index ac06063..a1e77af 100644 --- a/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt +++ b/small_small_hr/templates/small_small_hr/email/leave_application_email_body.txt @@ -1,4 +1,4 @@ -Hello {{name}}, +Hello, {{message}} diff --git a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html index 7fed0ef..f0d3095 100644 --- a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html +++ b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.html @@ -1,4 +1,4 @@ -Hello {{name}},

+Hello,

{{message|linebreaks}}

Thank you,
diff --git a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt index ac06063..a1e77af 100644 --- a/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt +++ b/small_small_hr/templates/small_small_hr/email/overtime_application_email_body.txt @@ -1,4 +1,4 @@ -Hello {{name}}, +Hello, {{message}} From 0521f1d4b401bfb6bb5faed7c87048101378cd03 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 23:41:26 +0300 Subject: [PATCH 2/5] Add setting for SSHR_ADMIN_NAME --- small_small_hr/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/small_small_hr/settings.py b/small_small_hr/settings.py index 9ae77c7..02546a0 100644 --- a/small_small_hr/settings.py +++ b/small_small_hr/settings.py @@ -25,6 +25,7 @@ {'day': 26, 'month': 12}, # Boxing day ] # these are days that are not counted when getting taken leave days # emails +SSHR_ADMIN_NAME = "HR" SSHR_ADMIN_EMAILS = [settings.DEFAULT_FROM_EMAIL] SSHR_ADMIN_LEAVE_EMAILS = SSHR_ADMIN_EMAILS SSHR_ADMIN_OVERTIME_EMAILS = SSHR_ADMIN_EMAILS From a39f9d37cb3bb335e5a490ca3b02c3e4d6d88f1f Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 23:42:06 +0300 Subject: [PATCH 3/5] Use `SSHR_ADMIN_NAME` as name in application emails --- small_small_hr/emails.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/small_small_hr/emails.py b/small_small_hr/emails.py index 9e3637c..ce5937c 100644 --- a/small_small_hr/emails.py +++ b/small_small_hr/emails.py @@ -68,7 +68,7 @@ def leave_application_email(leave_obj: object): for admin_email in admin_emails: send_email( - name=leave_obj.staff.get_name(), + name=settings.SSHR_ADMIN_NAME, email=admin_email, subject=subj, message=msg, @@ -118,7 +118,7 @@ def overtime_application_email(overtime_obj: object): for admin_email in admin_emails: send_email( - name=overtime_obj.staff.get_name(), + name=settings.SSHR_ADMIN_NAME, email=admin_email, subject=subj, message=msg, From 14fd530caa20ecef8ff35c202be7ab40ddc26866 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 23:42:21 +0300 Subject: [PATCH 4/5] Fix broken tests --- tests/test_emails.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_emails.py b/tests/test_emails.py index abeb5b1..2ec2846 100644 --- a/tests/test_emails.py +++ b/tests/test_emails.py @@ -21,7 +21,8 @@ @override_settings( SSHR_ADMIN_EMAILS=["admin@example.com"], SSHR_ADMIN_LEAVE_EMAILS=["hr@example.com"], - SSHR_ADMIN_OVERTIME_EMAILS=["ot@example.com"] + SSHR_ADMIN_OVERTIME_EMAILS=["ot@example.com"], + SSHR_ADMIN_NAME="mosh" ) class TestEmails(TestCase): """ @@ -55,7 +56,7 @@ def test_leave_application_email(self, mock): leave_application_email(leave) mock.assert_called_with( - name="Bob Ndoe", + name="mosh", email="hr@example.com", subject="New Leave Application", 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): overtime_application_email(overtime) mock.assert_called_with( - name="Bob Ndoe", + name="mosh", email="ot@example.com", subject="New Overtime Application", 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): leave_application_email(leave) context = dict( - name="Bob Ndoe", + name="mosh", subject="New Leave Application", message="There has been a new leave application. Please log in to process it.", # noqa object=leave, @@ -260,7 +261,7 @@ def test_send_email_templates(self, mock, site_mock): overtime_application_email(overtime) context = dict( - name="Bob Ndoe", + name="mosh", subject="New Overtime Application", message="There has been a new overtime application. Please log in to process it.", # noqa object=overtime, From e5bfb5f196b292f07ec5751a3ebda013bb07f317 Mon Sep 17 00:00:00 2001 From: Kelvin Jayanoris Date: Tue, 12 Feb 2019 23:43:53 +0300 Subject: [PATCH 5/5] =?UTF-8?q?=E2=86=91=20bump=20to=20version=200.1.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- small_small_hr/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/small_small_hr/__init__.py b/small_small_hr/__init__.py index 2097b5b..eef9640 100644 --- a/small_small_hr/__init__.py +++ b/small_small_hr/__init__.py @@ -1,7 +1,7 @@ """ Main init file for small_small_hr """ -VERSION = (0, 1, 5) +VERSION = (0, 1, 6) __version__ = '.'.join(str(v) for v in VERSION) # pylint: disable=invalid-name default_app_config = 'small_small_hr.apps.SmallSmallHrConfig' # noqa