user_details: use model's effective alert date when relevant (#75255)
gitea/authentic/pipeline/head This commit looks good
Details
gitea/authentic/pipeline/head This commit looks good
Details
This commit is contained in:
parent
9bd5853ef1
commit
119ae53ce3
|
@ -85,21 +85,27 @@
|
|||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if alert_date and deletion_date %}
|
||||
<p class="a2-manager-user-date-alert">
|
||||
{% if alert_date > now %}
|
||||
{% blocktrans %}Deletion alert email planned for {{ alert_date }}.{% endblocktrans %}
|
||||
{% else %}
|
||||
{% blocktrans %}Deletion alert email sent on {{ alert_date }}.{% endblocktrans %}
|
||||
{% endif %}
|
||||
</p>
|
||||
<p class="a2-manager-user-date-deletion">
|
||||
{% if deletion_date > now %}
|
||||
{% blocktrans %}Account deletion planned for {{ deletion_date }}.{% endblocktrans %}
|
||||
{% else %}
|
||||
{% blocktrans %}Account deletion pending (should have been performed on {{ deletion_date }}).{% endblocktrans %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if object.ou.clean_unused_accounts_alert and object.ou.clean_unused_accounts_deletion %}
|
||||
{% if alert_date %}
|
||||
<p class="a2-manager-user-date-alert">
|
||||
{% if object.last_account_deletion_alert %}
|
||||
{% blocktrans with alert_date=object.last_account_deletion_alert %}Deletion alert email sent on {{ alert_date }}.{% endblocktrans %}
|
||||
{% elif alert_date >= now %}
|
||||
{% blocktrans %}Deletion alert email planned for {{ alert_date }}.{% endblocktrans %}
|
||||
{% elif alert_date < now %}
|
||||
{% blocktrans %}Deletion alert email pending (should have been sent on {{ alert_date }}).{% endblocktrans %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if deletion_date %}
|
||||
<p class="a2-manager-user-date-deletion">
|
||||
{% if deletion_date > now %}
|
||||
{% blocktrans %}Account deletion planned for {{ deletion_date }}.{% endblocktrans %}
|
||||
{% else %}
|
||||
{% blocktrans %}Account deletion pending (should have been performed on {{ deletion_date }}).{% endblocktrans %}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% for data in user_data %}
|
||||
|
|
|
@ -961,7 +961,17 @@ def test_detail_view(app, admin, simple_user, freezer, user_ou1, ou1, settings):
|
|||
|
||||
freezer.move_to('2024-12-10')
|
||||
resp = login(app, admin, url)
|
||||
assert 'Deletion alert email sent on Dec. 1, 2024.' in resp.pyquery('.a2-manager-user-date-alert')[0].text
|
||||
assert (
|
||||
'Deletion alert email pending (should have been sent on Dec. 1, 2024).'
|
||||
in resp.pyquery('.a2-manager-user-date-alert')[0].text
|
||||
)
|
||||
user_ou1.last_account_deletion_alert = datetime.datetime(2024, 12, 1, 3)
|
||||
user_ou1.save()
|
||||
resp = app.get(url)
|
||||
assert (
|
||||
'Deletion alert email sent on Dec. 1, 2024, 3 a.m.'
|
||||
in resp.pyquery('.a2-manager-user-date-alert')[0].text
|
||||
)
|
||||
assert (
|
||||
'Account deletion planned for Dec. 31, 2024.'
|
||||
in resp.pyquery('.a2-manager-user-date-deletion')[0].text
|
||||
|
@ -970,7 +980,10 @@ def test_detail_view(app, admin, simple_user, freezer, user_ou1, ou1, settings):
|
|||
|
||||
freezer.move_to('2025-01-01')
|
||||
resp = login(app, admin, url)
|
||||
assert 'Deletion alert email sent on Dec. 1, 2024.' in resp.pyquery('.a2-manager-user-date-alert')[0].text
|
||||
assert (
|
||||
'Deletion alert email sent on Dec. 1, 2024, 3 a.m.'
|
||||
in resp.pyquery('.a2-manager-user-date-alert')[0].text
|
||||
)
|
||||
assert (
|
||||
'Account deletion pending (should have been performed on Dec. 31, 2024).'
|
||||
in resp.pyquery('.a2-manager-user-date-deletion')[0].text
|
||||
|
|
Loading…
Reference in New Issue