mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 20:13:46 +00:00 
			
		
		
		
	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:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							79ea4b6eb0
						
					
				
				
					commit
					bbd0f6e11c
				
			| @@ -23,7 +23,7 @@ from corporate.models.plans import CustomerPlan, CustomerPlanOffer, get_current_ | |||||||
| from corporate.models.sponsorships import ZulipSponsorshipRequest | from corporate.models.sponsorships import ZulipSponsorshipRequest | ||||||
| from zerver.lib.timestamp import timestamp_to_datetime | from zerver.lib.timestamp import timestamp_to_datetime | ||||||
| from zerver.models import Realm | 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 zerver.models.realms import get_org_type_display_name | ||||||
| from zilencer.lib.remote_counts import MissingDataError | from zilencer.lib.remote_counts import MissingDataError | ||||||
| from zilencer.models import ( | from zilencer.models import ( | ||||||
| @@ -127,6 +127,7 @@ class CloudSupportData: | |||||||
|     sponsorship_data: SponsorshipData |     sponsorship_data: SponsorshipData | ||||||
|     user_data: UserData |     user_data: UserData | ||||||
|     file_upload_usage: str |     file_upload_usage: str | ||||||
|  |     is_scrubbed: bool | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_stripe_customer_url(stripe_id: str) -> str: | 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, |         sponsorship_data=sponsorship_data, | ||||||
|         user_data=user_data, |         user_data=user_data, | ||||||
|         file_upload_usage=get_formatted_realm_upload_space_used(billing_session.realm), |         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(), | ||||||
|     ) |     ) | ||||||
|   | |||||||
| @@ -751,7 +751,7 @@ class TestSupportEndpoint(ZulipTestCase): | |||||||
|     def test_realm_support_view_queries(self) -> None: |     def test_realm_support_view_queries(self) -> None: | ||||||
|         iago = self.example_user("iago") |         iago = self.example_user("iago") | ||||||
|         self.login_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") |             result = self.client_get("/activity/support", {"q": "zulip"}, subdomain="zulip") | ||||||
|             self.assertEqual(result.status_code, 200) |             self.assertEqual(result.status_code, 200) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,10 @@ | |||||||
|     {% if realm_support_data[realm.id].sponsorship_data.has_discount %} |     {% if realm_support_data[realm.id].sponsorship_data.has_discount %} | ||||||
|         <p class="support-section-header">Has a discount 💸</p> |         <p class="support-section-header">Has a discount 💸</p> | ||||||
|     {% endif %} |     {% 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>Placeholder realm</b><br /> | ||||||
|     <b>Redirects to</b>: {{ realm.deactivated_redirect }} |     <b>Redirects to</b>: {{ realm.deactivated_redirect }} | ||||||
|     <a title="Copy URL" class="copy-button" data-clipboard-text="{{ 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 /> |     <b>File upload usage</b>: {{ realm_support_data[realm.id].file_upload_usage }}<br /> | ||||||
|     {% endif %} |     {% endif %} | ||||||
| </div> | </div> | ||||||
| {% if not realm.deactivated_redirect %} | {% if realm_is_scrubbed %} | ||||||
|  | {% elif not realm.deactivated_redirect %} | ||||||
| <div> | <div> | ||||||
|     <div class="realm-management-actions"> |     <div class="realm-management-actions"> | ||||||
|         <p class="support-section-header">🛠️ Realm management:</p> |         <p class="support-section-header">🛠️ Realm management:</p> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user