mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 13:39:41 -04:00
Let users archive their own trial mode services
At the moment we have a blanket rule that users can’t archive their own services, to prevent someone accidentally deleting a real live service, because that would be Very Bad. But the tickets we get from users asking us to delete services are for services they set up when they were just trying out Notify. There’s not much harm in letting users delete these services, the consequences of doing so are much lower than those of deleting a live service. And it should mean fewer support tickets for us to deal with.
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
margin-top: $gutter * 4 / 3;
|
||||
}
|
||||
|
||||
.top-gutter-2-3 {
|
||||
.top-gutter-1-2 {
|
||||
@extend %top-gutter;
|
||||
margin-top: $gutter-half;
|
||||
}
|
||||
|
||||
@@ -330,11 +330,22 @@ def service_switch_can_upload_document(service_id):
|
||||
@login_required
|
||||
@user_has_permissions('manage_service')
|
||||
def archive_service(service_id):
|
||||
if not current_service.active and (
|
||||
current_service.trial_mode or current_user.platform_admin
|
||||
):
|
||||
abort(403)
|
||||
if request.method == 'POST':
|
||||
service_api_client.archive_service(service_id)
|
||||
return redirect(url_for('.service_settings', service_id=service_id))
|
||||
flash(
|
||||
'‘{}’ was deleted'.format(current_service.name),
|
||||
'default_with_tick',
|
||||
)
|
||||
return redirect(url_for('.choose_account'))
|
||||
else:
|
||||
flash('There\'s no way to reverse this! Are you sure you want to archive this service?', 'delete')
|
||||
flash(
|
||||
'Are you sure you want to delete ‘{}’? There’s no way to undo this.'.format(current_service.name),
|
||||
'delete',
|
||||
)
|
||||
return service_settings(service_id)
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<div class="ajax-block-container">
|
||||
{% if messages %}
|
||||
<p class="bottom-gutter-2-3 top-gutter-2-3">
|
||||
<p class="bottom-gutter-2-3 top-gutter-1-2">
|
||||
<a href="{{ url_for('.inbox_download', service_id=current_service.id) }}" download class="heading-small">Download these messages</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
@@ -37,4 +37,3 @@
|
||||
|
||||
{{ previous_next_navigation(prev_page, next_page) }}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -353,32 +353,39 @@
|
||||
|
||||
{% endcall %}
|
||||
|
||||
<p>
|
||||
{% if current_service.active %}
|
||||
<span class="page-footer-delete-link page-footer-delete-link-without-button">
|
||||
<a href="{{ url_for('.archive_service', service_id=current_service.id) }}">
|
||||
Archive service
|
||||
</a>
|
||||
</span>
|
||||
<span class="page-footer-delete-link">
|
||||
<a href="{{ url_for('.suspend_service', service_id=current_service.id) }}" class="page-footer-delete-link">
|
||||
Suspend service
|
||||
</a>
|
||||
</span>
|
||||
{% else %}
|
||||
<div class="hint bottom-gutter-1-2">
|
||||
Service suspended
|
||||
</div>
|
||||
<span class="page-footer-delete-link page-footer-delete-link-without-button">
|
||||
<a href="{{ url_for('.resume_service', service_id=current_service.id) }}">
|
||||
Resume service
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if current_service.active and (current_service.trial_mode or current_user.platform_admin) %}
|
||||
<p class="top-gutter-1-2">
|
||||
<span class="page-footer-delete-link page-footer-delete-link-without-button">
|
||||
<a href="{{ url_for('.archive_service', service_id=current_service.id) }}">
|
||||
Delete this service
|
||||
</a>
|
||||
</span>
|
||||
{% if current_user.platform_admin %}
|
||||
<span class="page-footer-delete-link">
|
||||
<a href="{{ url_for('.suspend_service', service_id=current_service.id) }}" class="page-footer-delete-link">
|
||||
Suspend service
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if (not current_service.active) and current_user.platform_admin %}
|
||||
<p>
|
||||
<div class="hint bottom-gutter-1-2">
|
||||
Service suspended
|
||||
</div>
|
||||
<span class="page-footer-delete-link page-footer-delete-link-without-button">
|
||||
<a href="{{ url_for('.resume_service', service_id=current_service.id) }}">
|
||||
Resume service
|
||||
</a>
|
||||
</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user