mirror of https://github.com/zulip/zulip.git
Change if(realm.domain == zulip.com) checks to use Realm.string_id.
This commit is contained in:
parent
128c431f14
commit
3aae6cd421
|
@ -581,7 +581,7 @@ def fetch_user_profile_cross_realm(response, config, context):
|
|||
# type: (TableData, Config, Context) -> None
|
||||
realm = context['realm']
|
||||
|
||||
if realm.domain == "zulip.com":
|
||||
if realm.string_id == "zulip":
|
||||
response['zerver_userprofile_crossrealm'] = []
|
||||
else:
|
||||
response['zerver_userprofile_crossrealm'] = [dict(email=x.email, id=x.id) for x in [
|
||||
|
|
|
@ -393,7 +393,7 @@ def send_future_email(recipients, email_html, email_text, subject,
|
|||
settings.EMAIL_BACKEND != 'django.core.mail.backends.console.EmailBackend':
|
||||
for recipient in recipients:
|
||||
email = recipient.get("email")
|
||||
if get_user_profile_by_email(email).realm.domain != "zulip.com":
|
||||
if get_user_profile_by_email(email).realm.string_id != "zulip":
|
||||
raise ValueError("digest: refusing to send emails to non-zulip.com users.")
|
||||
|
||||
# message = {"from_email": "othello@zulip.com",
|
||||
|
|
|
@ -184,7 +184,7 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
|||
|
||||
# invalid realm of 999999 (for non-zulip.com)
|
||||
user = get_user_profile_by_email('hamlet@zulip.com')
|
||||
user.realm.domain = 'example.com'
|
||||
user.realm.string_id = 'not-zulip'
|
||||
user.realm.save()
|
||||
|
||||
with use_s3(), getting_realm_id(999999):
|
||||
|
|
|
@ -28,7 +28,7 @@ def serve_s3(request, user_profile, realm_id_str, filename):
|
|||
realm_id = int(realm_id_str)
|
||||
|
||||
# Internal users can access all uploads so we can receive attachments in cross-realm messages
|
||||
if user_profile.realm_id == realm_id or user_profile.realm.domain == 'zulip.com':
|
||||
if user_profile.realm_id == realm_id or user_profile.realm.string_id == 'zulip':
|
||||
uri = get_signed_upload_url(url_path)
|
||||
return redirect(uri)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue