diff --git a/zilencer/models.py b/zilencer/models.py index 90835656c4..cbfb147ff8 100644 --- a/zilencer/models.py +++ b/zilencer/models.py @@ -18,3 +18,11 @@ class Deployment(models.Model): @property def endpoints(self): return {'base_api_url': self.base_api_url, 'base_site_url': self.base_site_url} + + @property + def name(self): + # TODO: This only does the right thing for prod because prod authenticates to + # staging with the zulip.com deployment key, while staging is technically the + # deployment for the zulip.com realm. + # This also doesn't necessarily handle other multi-realm deployments correctly. + return self.realms.order_by('pk')[0].domain diff --git a/zilencer/views.py b/zilencer/views.py index 9d2f4aa62d..27ee32a602 100644 --- a/zilencer/views.py +++ b/zilencer/views.py @@ -27,7 +27,7 @@ def get_ticket_number(): def submit_feedback(request, deployment, message=REQ(converter=json_to_dict)): domainish = message["sender_domain"] if get_realm("zulip.com") not in deployment.realms.all(): - domainish += " via " + deployment.realms.get(0).domain + domainish += " via " + deployment.name subject = "feedback: %s (%s)" % (message["sender_email"], domainish) if len(subject) > 60: