demo-orgs: Add email address visibility update to add email modal.

Adds a field to update the demo organization owner's email address
visibility setting when they are adding an email to their account.
This commit is contained in:
Lauryn Menard
2025-10-20 18:44:10 +02:00
committed by Tim Abbott
parent ef2c2fe885
commit 476ee37bf3
2 changed files with 18 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ import {page_params} from "./page_params.ts";
import * as people from "./people.ts"; import * as people from "./people.ts";
import * as settings_bots from "./settings_bots.ts"; import * as settings_bots from "./settings_bots.ts";
import * as settings_components from "./settings_components.ts"; import * as settings_components from "./settings_components.ts";
import * as settings_config from "./settings_config.ts";
import * as settings_data from "./settings_data.ts"; import * as settings_data from "./settings_data.ts";
import * as settings_org from "./settings_org.ts"; import * as settings_org from "./settings_org.ts";
import * as settings_ui from "./settings_ui.ts"; import * as settings_ui from "./settings_ui.ts";
@@ -640,6 +641,7 @@ export function set_up(): void {
const data = { const data = {
email: $<HTMLInputElement>("input#demo_organization_add_email").val(), email: $<HTMLInputElement>("input#demo_organization_add_email").val(),
full_name: $("#demo_organization_update_full_name").val(), full_name: $("#demo_organization_update_full_name").val(),
email_address_visibility: $("#demo_owner_email_address_visibility").val(),
}; };
const opts = { const opts = {
@@ -678,6 +680,9 @@ export function set_up(): void {
e.stopPropagation(); e.stopPropagation();
function demo_organization_add_email_post_render(): void { function demo_organization_add_email_post_render(): void {
// Set email address visibility to current user setting.
$("#demo_owner_email_address_visibility").val(user_settings.email_address_visibility);
// Disable submit button if either input is an empty string. // Disable submit button if either input is an empty string.
const $add_email_element = $<HTMLInputElement>("input#demo_organization_add_email"); const $add_email_element = $<HTMLInputElement>("input#demo_organization_add_email");
const $add_name_element = $<HTMLInputElement>( const $add_name_element = $<HTMLInputElement>(
@@ -708,6 +713,8 @@ export function set_up(): void {
html_body: render_demo_organization_add_email_modal({ html_body: render_demo_organization_add_email_modal({
delivery_email: current_user.delivery_email, delivery_email: current_user.delivery_email,
full_name: current_user.full_name, full_name: current_user.full_name,
email_address_visibility_values:
settings_config.email_address_visibility_values,
}), }),
html_submit_button: $t_html({defaultMessage: "Add"}), html_submit_button: $t_html({defaultMessage: "Add"}),
loading_spinner: true, loading_spinner: true,

View File

@@ -3,6 +3,17 @@
<label for="demo_organization_add_email" class="modal-field-label">{{t "Email" }}</label> <label for="demo_organization_add_email" class="modal-field-label">{{t "Email" }}</label>
<input id="demo_organization_add_email" type="text" name="email" class="modal_text_input" value="{{delivery_email}}" autocomplete="off" spellcheck="false" autofocus="autofocus"/> <input id="demo_organization_add_email" type="text" name="email" class="modal_text_input" value="{{delivery_email}}" autocomplete="off" spellcheck="false" autofocus="autofocus"/>
</div> </div>
<div class="input-group">
<label for="demo_owner_email_address_visibility" class="modal-field-label">
{{t "Who can access your email address"}}
{{> help_link_widget link="/help/configure-email-visibility" }}
</label>
<select id="demo_owner_email_address_visibility" name="demo_owner_email_address_visibility" class="modal_select bootstrap-focus-style">
{{#each email_address_visibility_values}}
<option value="{{this.code}}">{{this.description}}</option>
{{/each}}
</select>
</div>
<div class="input-group"> <div class="input-group">
<label for="demo_organization_update_full_name" class="modal-field-label">{{t "Name" }}</label> <label for="demo_organization_update_full_name" class="modal-field-label">{{t "Name" }}</label>
<p id="demo-owner-update-email-field-hint"> <p id="demo-owner-update-email-field-hint">