support: Revise view for scrubbed realms.

When a realm is scrubbed, there should be no support actions to
take and all user information has been removed.
This commit is contained in:
Lauryn Menard
2025-06-17 20:57:05 +02:00
committed by Tim Abbott
parent 79ea4b6eb0
commit bbd0f6e11c
3 changed files with 12 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ from corporate.models.plans import CustomerPlan, CustomerPlanOffer, get_current_
from corporate.models.sponsorships import ZulipSponsorshipRequest
from zerver.lib.timestamp import timestamp_to_datetime
from zerver.models import Realm
from zerver.models.realm_audit_logs import AuditLogEventType
from zerver.models.realm_audit_logs import AuditLogEventType, RealmAuditLog
from zerver.models.realms import get_org_type_display_name
from zilencer.lib.remote_counts import MissingDataError
from zilencer.models import (
@@ -127,6 +127,7 @@ class CloudSupportData:
sponsorship_data: SponsorshipData
user_data: UserData
file_upload_usage: str
is_scrubbed: bool
def get_stripe_customer_url(stripe_id: str) -> str:
@@ -498,4 +499,7 @@ def get_data_for_cloud_support_view(billing_session: BillingSession) -> CloudSup
sponsorship_data=sponsorship_data,
user_data=user_data,
file_upload_usage=get_formatted_realm_upload_space_used(billing_session.realm),
is_scrubbed=RealmAuditLog.objects.filter(
realm=billing_session.realm, event_type=AuditLogEventType.REALM_SCRUBBED
).exists(),
)

View File

@@ -751,7 +751,7 @@ class TestSupportEndpoint(ZulipTestCase):
def test_realm_support_view_queries(self) -> None:
iago = self.example_user("iago")
self.login_user(iago)
with self.assert_database_query_count(22):
with self.assert_database_query_count(23):
result = self.client_get("/activity/support", {"q": "zulip"}, subdomain="zulip")
self.assertEqual(result.status_code, 200)

View File

@@ -10,7 +10,10 @@
{% if realm_support_data[realm.id].sponsorship_data.has_discount %}
<p class="support-section-header">Has a discount 💸</p>
{% endif %}
{% if realm.deactivated_redirect %}
{% set realm_is_scrubbed = realm_support_data[realm.id].is_scrubbed %}
{% if realm_is_scrubbed %}
<b>Realm has been scrubbed</b>
{% elif realm.deactivated_redirect %}
<b>Placeholder realm</b><br />
<b>Redirects to</b>: {{ realm.deactivated_redirect }}
<a title="Copy URL" class="copy-button" data-clipboard-text="{{ realm.deactivated_redirect }}">
@@ -69,7 +72,8 @@
<b>File upload usage</b>: {{ realm_support_data[realm.id].file_upload_usage }}<br />
{% endif %}
</div>
{% if not realm.deactivated_redirect %}
{% if realm_is_scrubbed %}
{% elif not realm.deactivated_redirect %}
<div>
<div class="realm-management-actions">
<p class="support-section-header">🛠️ Realm management:</p>