From 8ca060531fac9eeb2b5f22c7f380a04c292ec81b Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Wed, 3 May 2023 19:46:39 +0530 Subject: [PATCH] templates: Extract html for new user email address visibility. This commit extracts html for setting new user email address visibility in the registration page to a separate file. This new file will then be used to allow imported users set email visibility during login without having to duplicate the code. --- .../new_user_email_address_visibility.html | 19 ++++++++++++++++++ templates/zerver/register.html | 20 +------------------ 2 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 templates/zerver/new_user_email_address_visibility.html diff --git a/templates/zerver/new_user_email_address_visibility.html b/templates/zerver/new_user_email_address_visibility.html new file mode 100644 index 0000000000..6bd577aa00 --- /dev/null +++ b/templates/zerver/new_user_email_address_visibility.html @@ -0,0 +1,19 @@ +

+ + + {% if default_email_address_visibility == email_address_visibility_admins_only %} + {% trans %}Administrators of this Zulip organization will be able to see this email address. + {% endtrans %} + {% elif default_email_address_visibility == email_address_visibility_moderators %} + {% trans %}Administrators and moderators of this Zulip organization will be able to see this email address. + {% endtrans %} + {% elif default_email_address_visibility == email_address_visibility_nobody %} + {% trans %}Nobody in this Zulip organization will be able to see this email address. + {% endtrans %} + {% else %} + {% trans %}Other users in this Zulip organization will be able to see this email address. + {% endtrans %} + {% endif %} + + {{ _('Change') }} +

diff --git a/templates/zerver/register.html b/templates/zerver/register.html index c6834e3fb7..a8ce41ae45 100644 --- a/templates/zerver/register.html +++ b/templates/zerver/register.html @@ -76,28 +76,10 @@ Form is validated both client-side using jquery-validation (see signup.js) and s
-
{{ email }}
{% if not creating_new_realm %} -

- - {% if default_email_address_visibility == email_address_visibility_admins_only %} - {% trans %}Administrators of this Zulip organization will be able to see this email address. - {% endtrans %} - {% elif default_email_address_visibility == email_address_visibility_moderators %} - {% trans %}Administrators and moderators of this Zulip organization will be able to see this email address. - {% endtrans %} - {% elif default_email_address_visibility == email_address_visibility_nobody %} - {% trans %}Nobody in this Zulip organization will be able to see this email address. - {% endtrans %} - {% else %} - {% trans %}Other users in this Zulip organization will be able to see this email address. - {% endtrans %} - {% endif %} - - {{ _('Change') }} -

+ {% include 'zerver/new_user_email_address_visibility.html' %} {% endif %}