Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
remote-support: Show active billing user emails.
Lauryn Menard1f72ab51330c
diff --git a/corporate/views/support.py b/corporate/views/support.pyindex 9e55b0a5cc1..0acb144b1d0 100644--- a/corporate/views/support.py+++ b/corporate/views/support.py@@ -661,6 +661,20 @@ def remote_servers_support("Recent analytics data missing")+ def get_remote_server_billing_user_emails_as_string(remote_server: RemoteZulipServer) -> str:+ return ", ".join(+ remote_server.get_remote_server_billing_users()+ .order_by("email")+ .values_list("email", flat=True)+ )++ def get_remote_realm_billing_user_emails_as_string(remote_realm: RemoteRealm) -> str:+ return ", ".join(+ remote_realm.get_remote_realm_billing_users()+ .order_by("email")+ .values_list("email", flat=True)+ )+context["remote_servers"] = remote_serverscontext["remote_servers_support_data"] = server_support_datacontext["remote_server_to_max_monthly_messages"] = remote_server_to_max_monthly_messages@@ -673,6 +687,10 @@ def remote_servers_support(context["dollar_amount"] = cents_to_dollar_stringcontext["server_analytics_link"] = remote_installation_stats_linkcontext["REMOTE_PLAN_TIERS"] = get_remote_plan_tier_options()+ context["get_remote_server_billing_user_emails"] = (+ get_remote_server_billing_user_emails_as_string+ )+ context["get_remote_realm_billing_user_emails"] = get_remote_realm_billing_user_emails_as_stringcontext["SPONSORED_PLAN_TYPE"] = RemoteZulipServer.PLAN_TYPE_COMMUNITYreturn render(diff --git a/templates/corporate/support/remote_realm_details.html b/templates/corporate/support/remote_realm_details.htmlindex d8c2cef7f87..bcc4cf7fb6a 100644--- a/templates/corporate/support/remote_realm_details.html+++ b/templates/corporate/support/remote_realm_details.html@@ -18,6 +18,14 @@<p class="support-section-header">Has a discount 💸</p>{% endif %}<b>Remote realm host:</b> {{ remote_realm.host }}<br />+ {% set billing_emails_string = get_remote_realm_billing_user_emails(remote_realm) %}+ <b>Billing users</b>: {{ billing_emails_string }}+ {% if billing_emails_string %}+ <a title="Copy emails" class="copy-button" data-copytext="{{ billing_emails_string }}">+ <i class="fa fa-copy"></i>+ </a>+ {% endif %}+ <br /><b>Date created</b>: {{ support_data[remote_realm.id].date_created.strftime('%d %B %Y') }}<br /><b>Org type</b>: {{ get_org_type_display_name(remote_realm.org_type) }}<br /><b>Plan type</b>: {{ get_plan_type_name(remote_realm.plan_type) }}<br />diff --git a/templates/corporate/support/remote_server_support.html b/templates/corporate/support/remote_server_support.htmlindex 93fa7729bbd..5a5b8abc180 100644--- a/templates/corporate/support/remote_server_support.html+++ b/templates/corporate/support/remote_server_support.html@@ -49,6 +49,14 @@<i class="fa fa-copy"></i></a><br />+ {% set billing_emails_string = get_remote_server_billing_user_emails(remote_server) %}+ <b>Billing users</b>: {{ billing_emails_string }}+ {% if billing_emails_string %}+ <a title="Copy emails" class="copy-button" data-copytext="{{ billing_emails_string }}">+ <i class="fa fa-copy"></i>+ </a>+ {% endif %}+ <br /><b>UUID</b>: {{ remote_server.uuid }}<br /><b>Date created</b>: {{ remote_servers_support_data[remote_server.id].date_created.strftime('%d %B %Y') }}<br /><b>Zulip version</b>: {{ remote_server.last_version }}<br />diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.pyindex 93acb9c7311..7ce19f62091 100644--- a/tools/linter_lib/custom_check.py+++ b/tools/linter_lib/custom_check.py@@ -631,6 +631,7 @@ html_rules: List["Rule"] = ["templates/corporate/support/realm_details.html","templates/corporate/support/remote_server_support.html","templates/corporate/support/support.html",+ "templates/corporate/support/remote_realm_details.html",},"description": "`title` value should be translatable.",},diff --git a/zilencer/models.py b/zilencer/models.pyindex 5fdb5591eba..75870a6e087 100644--- a/zilencer/models.py+++ b/zilencer/models.py@@ -8,7 +8,7 @@ from typing import List, Tuplefrom django.conf import settingsfrom django.core.exceptions import ValidationErrorfrom django.db import models-from django.db.models import Max, Q, UniqueConstraint+from django.db.models import Max, Q, QuerySet, UniqueConstraintfrom django.utils.timezone import now as timezone_nowfrom typing_extensions import override@@ -88,6 +88,12 @@ class RemoteZulipServer(models.Model):def format_requester_for_logs(self) -> str:return "zulip-server:" + str(self.uuid)+ def get_remote_server_billing_users(self) -> QuerySet["RemoteServerBillingUser"]:+ return RemoteServerBillingUser.objects.filter(+ remote_server=self,+ is_active=True,+ )+class RemotePushDeviceToken(AbstractPushDeviceToken):"""Like PushDeviceToken, but for a device connected to a remote server."""@@ -176,6 +182,12 @@ class RemoteRealm(models.Model):def __str__(self) -> str:return f"{self.host} {str(self.uuid)[0:12]}"+ def get_remote_realm_billing_users(self) -> QuerySet["RemoteRealmBillingUser"]:+ return RemoteRealmBillingUser.objects.filter(+ remote_realm=self,+ is_active=True,+ )+class AbstractRemoteRealmBillingUser(models.Model):remote_realm = models.ForeignKey(RemoteRealm, on_delete=models.CASCADE)