From d991da1f7a3665e112fc10e6c1460c7ce92e6b56 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Mon, 11 Mar 2024 16:38:43 -0300 Subject: [PATCH] Add library name to loan notifications. (#1721) --- core/util/notifications.py | 3 ++- tests/core/util/test_notifications.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/util/notifications.py b/core/util/notifications.py index ead843fbbd..ba55ed5a91 100644 --- a/core/util/notifications.py +++ b/core/util/notifications.py @@ -106,8 +106,9 @@ def send_loan_expiry_message( edition = loan.license_pool.presentation_edition identifier = loan.license_pool.identifier library_short_name = loan.library.short_name + library_name = loan.library.name title = f"Only {days_to_expiry} {'days' if days_to_expiry != 1 else 'day'} left on your loan!" - body = f"Your loan on {edition.title} is expiring soon" + body = f'Your loan for "{edition.title}" at {library_name} is expiring soon' data = dict( title=title, body=body, diff --git a/tests/core/util/test_notifications.py b/tests/core/util/test_notifications.py index e09c86fe9e..38caf3fea6 100644 --- a/tests/core/util/test_notifications.py +++ b/tests/core/util/test_notifications.py @@ -106,7 +106,7 @@ def test_send_loan_notification(self, push_notf_fixture: PushNotificationsFixtur ), "data": dict( title="Only 1 day left on your loan!", - body=f"Your loan on {work.presentation_edition.title} is expiring soon", + body=f'Your loan for "{work.presentation_edition.title}" at {loan.library.name} is expiring soon', event_type=NotificationConstants.LOAN_EXPIRY_TYPE, loans_endpoint="http://localhost/default/loans", external_identifier=patron.external_identifier,