mirror of https://github.com/zulip/zulip.git
remote-support: Show active billing user emails.
This commit is contained in:
parent
3d1cf0619b
commit
1f72ab5133
|
@ -661,6 +661,20 @@ def remote_servers_support(
|
||||||
"Recent analytics data missing"
|
"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_servers
|
context["remote_servers"] = remote_servers
|
||||||
context["remote_servers_support_data"] = server_support_data
|
context["remote_servers_support_data"] = server_support_data
|
||||||
context["remote_server_to_max_monthly_messages"] = remote_server_to_max_monthly_messages
|
context["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_string
|
context["dollar_amount"] = cents_to_dollar_string
|
||||||
context["server_analytics_link"] = remote_installation_stats_link
|
context["server_analytics_link"] = remote_installation_stats_link
|
||||||
context["REMOTE_PLAN_TIERS"] = get_remote_plan_tier_options()
|
context["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_string
|
||||||
context["SPONSORED_PLAN_TYPE"] = RemoteZulipServer.PLAN_TYPE_COMMUNITY
|
context["SPONSORED_PLAN_TYPE"] = RemoteZulipServer.PLAN_TYPE_COMMUNITY
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
|
|
|
@ -18,6 +18,14 @@
|
||||||
<p class="support-section-header">Has a discount 💸</p>
|
<p class="support-section-header">Has a discount 💸</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<b>Remote realm host:</b> {{ remote_realm.host }}<br />
|
<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>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>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 />
|
<b>Plan type</b>: {{ get_plan_type_name(remote_realm.plan_type) }}<br />
|
||||||
|
|
|
@ -49,6 +49,14 @@
|
||||||
<i class="fa fa-copy"></i>
|
<i class="fa fa-copy"></i>
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<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>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>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 />
|
<b>Zulip version</b>: {{ remote_server.last_version }}<br />
|
||||||
|
|
|
@ -631,6 +631,7 @@ html_rules: List["Rule"] = [
|
||||||
"templates/corporate/support/realm_details.html",
|
"templates/corporate/support/realm_details.html",
|
||||||
"templates/corporate/support/remote_server_support.html",
|
"templates/corporate/support/remote_server_support.html",
|
||||||
"templates/corporate/support/support.html",
|
"templates/corporate/support/support.html",
|
||||||
|
"templates/corporate/support/remote_realm_details.html",
|
||||||
},
|
},
|
||||||
"description": "`title` value should be translatable.",
|
"description": "`title` value should be translatable.",
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,7 +8,7 @@ from typing import List, Tuple
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Max, Q, UniqueConstraint
|
from django.db.models import Max, Q, QuerySet, UniqueConstraint
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
|
@ -88,6 +88,12 @@ class RemoteZulipServer(models.Model):
|
||||||
def format_requester_for_logs(self) -> str:
|
def format_requester_for_logs(self) -> str:
|
||||||
return "zulip-server:" + str(self.uuid)
|
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):
|
class RemotePushDeviceToken(AbstractPushDeviceToken):
|
||||||
"""Like PushDeviceToken, but for a device connected to a remote server."""
|
"""Like PushDeviceToken, but for a device connected to a remote server."""
|
||||||
|
@ -176,6 +182,12 @@ class RemoteRealm(models.Model):
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f"{self.host} {str(self.uuid)[0:12]}"
|
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):
|
class AbstractRemoteRealmBillingUser(models.Model):
|
||||||
remote_realm = models.ForeignKey(RemoteRealm, on_delete=models.CASCADE)
|
remote_realm = models.ForeignKey(RemoteRealm, on_delete=models.CASCADE)
|
||||||
|
|
Loading…
Reference in New Issue