mirror of https://github.com/zulip/zulip.git
email: Add a space after the time and AM/PM in the login email.
This is more typical formatting for times. Fixes #27727.
This commit is contained in:
parent
d6a2bbc2ef
commit
adc11e5ba2
|
@ -100,7 +100,7 @@ def email_on_new_login(sender: Any, user: UserProfile, request: Any, **kwargs: A
|
||||||
if user.twenty_four_hour_time:
|
if user.twenty_four_hour_time:
|
||||||
hhmm_string = local_time.strftime("%H:%M")
|
hhmm_string = local_time.strftime("%H:%M")
|
||||||
else:
|
else:
|
||||||
hhmm_string = local_time.strftime("%I:%M%p")
|
hhmm_string = local_time.strftime("%I:%M %p")
|
||||||
context["login_time"] = local_time.strftime(f"%A, %B %d, %Y at {hhmm_string} %Z")
|
context["login_time"] = local_time.strftime(f"%A, %B %d, %Y at {hhmm_string} %Z")
|
||||||
context["device_ip"] = request.META.get("REMOTE_ADDR") or _("Unknown IP address")
|
context["device_ip"] = request.META.get("REMOTE_ADDR") or _("Unknown IP address")
|
||||||
context["device_os"] = get_device_os(user_agent) or _("an unknown operating system")
|
context["device_os"] = get_device_os(user_agent) or _("an unknown operating system")
|
||||||
|
|
|
@ -54,7 +54,7 @@ class SendLoginEmailTest(ZulipTestCase):
|
||||||
)
|
)
|
||||||
user_tz = zoneinfo.ZoneInfo(user.timezone)
|
user_tz = zoneinfo.ZoneInfo(user.timezone)
|
||||||
mock_time = datetime.datetime(year=2018, month=1, day=1, tzinfo=datetime.timezone.utc)
|
mock_time = datetime.datetime(year=2018, month=1, day=1, tzinfo=datetime.timezone.utc)
|
||||||
reference_time = mock_time.astimezone(user_tz).strftime("%A, %B %d, %Y at %I:%M%p %Z")
|
reference_time = mock_time.astimezone(user_tz).strftime("%A, %B %d, %Y at %I:%M %p %Z")
|
||||||
with mock.patch("zerver.signals.timezone_now", return_value=mock_time):
|
with mock.patch("zerver.signals.timezone_now", return_value=mock_time):
|
||||||
self.client_post(
|
self.client_post(
|
||||||
"/accounts/login/", info=login_info, HTTP_USER_AGENT=firefox_windows
|
"/accounts/login/", info=login_info, HTTP_USER_AGENT=firefox_windows
|
||||||
|
|
Loading…
Reference in New Issue