mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 16:14:02 +00:00
support: Fix arguments of timesince for expires_in.
`expires_in` (remaining time before the invite expires) should be calculated from the time at present, not from the time when confirmation link was sent.
This commit is contained in:
@@ -670,7 +670,7 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
self.assert_in_success_response(['<span class="label">invite</span>'], result)
|
||||
self.assert_in_success_response(
|
||||
[
|
||||
"<b>Expires in</b>: 1\xa0week, 3",
|
||||
"<b>Expires in</b>: 1\xa0week, 3\xa0days",
|
||||
"<b>Status</b>: Link has never been clicked",
|
||||
],
|
||||
result,
|
||||
@@ -679,7 +679,10 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
else:
|
||||
self.assert_not_in_success_response(['<span class="label">invite</span>'], result)
|
||||
self.assert_in_success_response(
|
||||
["<b>Expires in</b>: 1\xa0day", "<b>Status</b>: Link has never been clicked"],
|
||||
[
|
||||
"<b>Expires in</b>: 1\xa0day",
|
||||
"<b>Status</b>: Link has never been clicked",
|
||||
],
|
||||
result,
|
||||
)
|
||||
|
||||
@@ -689,7 +692,7 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
'<span class="label">preregistration user</span>\n',
|
||||
'<span class="label">realm creation</span>\n',
|
||||
"<b>Link</b>: http://testserver/accounts/do_confirm/",
|
||||
"<b>Expires in</b>: 1\xa0day<br>\n",
|
||||
"<b>Expires in</b>: 1\xa0day",
|
||||
],
|
||||
result,
|
||||
)
|
||||
@@ -699,7 +702,7 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
[
|
||||
'<span class="label">multiuse invite</span>\n',
|
||||
"<b>Link</b>: http://zulip.testserver/join/",
|
||||
"<b>Expires in</b>: 1\xa0week, 3",
|
||||
"<b>Expires in</b>: 1\xa0week, 3\xa0days",
|
||||
],
|
||||
result,
|
||||
)
|
||||
@@ -789,6 +792,9 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
check_zulip_realm_query_result(result)
|
||||
check_lear_realm_query_result(result)
|
||||
|
||||
with mock.patch(
|
||||
"analytics.views.timezone_now", return_value=timezone_now() - timedelta(minutes=50)
|
||||
):
|
||||
self.client_post("/accounts/home/", {"email": self.nonreg_email("test")})
|
||||
self.login("iago")
|
||||
result = self.client_get("/activity/support", {"q": self.nonreg_email("test")})
|
||||
|
@@ -1238,8 +1238,9 @@ def get_confirmations(
|
||||
else:
|
||||
link_status = ""
|
||||
|
||||
if timezone_now() < expiry_date:
|
||||
expires_in = timesince(confirmation.date_sent, expiry_date)
|
||||
now = timezone_now()
|
||||
if now < expiry_date:
|
||||
expires_in = timesince(now, expiry_date)
|
||||
else:
|
||||
expires_in = "Expired"
|
||||
|
||||
|
Reference in New Issue
Block a user