diff --git a/static/js/avatar.js b/static/js/avatar.js index bb7da1ea45..7bc9a70833 100644 --- a/static/js/avatar.js +++ b/static/js/avatar.js @@ -103,7 +103,6 @@ export function build_user_avatar_widget(upload_function) { parent: modal_parent, html_heading: $t_html({defaultMessage: "Delete profile picture"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: delete_user_avatar, fade: true, }); diff --git a/static/js/confirm_dialog.js b/static/js/confirm_dialog.js index 38a8570d1f..12af40c8c1 100644 --- a/static/js/confirm_dialog.js +++ b/static/js/confirm_dialog.js @@ -1,5 +1,10 @@ +import {$t_html} from "./i18n"; import * as dialog_widget from "./dialog_widget"; export function launch(conf) { - dialog_widget.launch({...conf, is_confirm_dialog: true}); + dialog_widget.launch( + {...conf, + html_submit_button: $t_html({defaultMessage: "Confirm"}), + is_confirm_dialog: true, + }); } diff --git a/static/js/dialog_widget.js b/static/js/dialog_widget.js index 01487c1e46..1d00fe0850 100644 --- a/static/js/dialog_widget.js +++ b/static/js/dialog_widget.js @@ -4,6 +4,7 @@ import render_dialog_widget from "../templates/dialog_widget.hbs"; import render_dialog_heading from "../templates/dialog_widget_heading.hbs"; import * as blueslip from "./blueslip"; +import {$t_html} from "./i18n"; import * as overlays from "./overlays"; import * as settings_data from "./settings_data"; @@ -64,18 +65,17 @@ export function launch(conf) { const html = render_dialog_widget({fade: conf.fade}); const dialog = $(html); - const conf_fields = [ - // The next three fields should be safe HTML. If callers + const mandatory_fields = [ + // The html_ fields should be safe HTML. If callers // interpolate user data into strings, they should use // templates. "html_heading", "html_body", - "html_submit_button", "on_click", "parent", ]; - for (const f of conf_fields) { + for (const f of mandatory_fields) { if (conf[f] === undefined) { blueslip.error("programmer omitted " + f); } @@ -99,7 +99,8 @@ export function launch(conf) { const submit_button_span = dialog.find(".dialog_submit_button span"); - submit_button_span.html(conf.html_submit_button); + let html_submit_button = conf.html_submit_button || $t_html({defaultMessage: "Save changes"}); + submit_button_span.html(html_submit_button); if (conf.post_render !== undefined) { conf.post_render(); diff --git a/static/js/message_edit.js b/static/js/message_edit.js index 606110d4df..4e0bde5d63 100644 --- a/static/js/message_edit.js +++ b/static/js/message_edit.js @@ -1004,7 +1004,6 @@ export function delete_message(msg_id) { parent: modal_parent, html_heading: $t_html({defaultMessage: "Delete message"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), help_link: "/help/edit-or-delete-a-message#delete-a-message", on_click: do_delete_message, loading_spinner: true, diff --git a/static/js/muted_users_ui.js b/static/js/muted_users_ui.js index c7178e27cd..7f7b685d51 100644 --- a/static/js/muted_users_ui.js +++ b/static/js/muted_users_ui.js @@ -37,7 +37,6 @@ export function confirm_mute_user(user_id) { html_heading: $t({defaultMessage: "Mute user"}), help_link: "/help/mute-a-user", html_body, - html_submit_button: $t({defaultMessage: "Confirm"}), on_click, }); } diff --git a/static/js/settings_account.js b/static/js/settings_account.js index 6d90ddee2b..b43d790ba4 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -603,7 +603,6 @@ export function set_up() { parent: modal_parent, html_heading: $t_html({defaultMessage: "Deactivate your account"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: handle_confirm, help_link: "/help/deactivate-your-account", fade: true, diff --git a/static/js/settings_emoji.js b/static/js/settings_emoji.js index c1de73ea99..9d28586657 100644 --- a/static/js/settings_emoji.js +++ b/static/js/settings_emoji.js @@ -269,7 +269,6 @@ export function set_up() { parent: modal_parent, html_heading: $t_html({defaultMessage: "Override built-in emoji?"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: submit_custom_emoji_request, fade: true, }); diff --git a/static/js/settings_invites.js b/static/js/settings_invites.js index 01e529acb0..3ca391b9ea 100644 --- a/static/js/settings_invites.js +++ b/static/js/settings_invites.js @@ -206,7 +206,6 @@ export function on_load_success(invites_data, initialize_event_handlers) { ? $t_html({defaultMessage: "Revoke invitation link"}) : $t_html({defaultMessage: "Revoke invitation to {email}"}, {email}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: do_revoke_invite, fade: true, }); @@ -232,7 +231,6 @@ export function on_load_success(invites_data, initialize_event_handlers) { parent: modal_parent, html_heading: $t_html({defaultMessage: "Resend invitation"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: do_resend_invite, fade: true, }); diff --git a/static/js/settings_org.js b/static/js/settings_org.js index dcfcb6b2bc..5fdcbdb3db 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -1174,7 +1174,6 @@ export function build_page() { html_heading: $t_html({defaultMessage: "Deactivate organization"}), help_link: "/help/deactivate-your-organization", html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: do_deactivate_realm, fade: true, }); diff --git a/static/js/settings_user_groups.js b/static/js/settings_user_groups.js index 969bae884a..24c8621901 100644 --- a/static/js/settings_user_groups.js +++ b/static/js/settings_user_groups.js @@ -366,7 +366,6 @@ export function set_up() { parent: modal_parent, html_heading: $t_html({defaultMessage: "Delete user group"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: delete_user_group, fade: true, }); diff --git a/static/js/settings_users.js b/static/js/settings_users.js index fb17d753fc..05e2ee4633 100644 --- a/static/js/settings_users.js +++ b/static/js/settings_users.js @@ -447,7 +447,6 @@ function confirm_deactivation(row, user_id, status_field) { parent: modal_parent, html_heading: $t_html({defaultMessage: "Deactivate {email}"}, {email: user.email}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: handle_confirm, fade: true, }); diff --git a/static/js/starred_messages_ui.js b/static/js/starred_messages_ui.js index b2a0f61f35..d017cc1c7e 100644 --- a/static/js/starred_messages_ui.js +++ b/static/js/starred_messages_ui.js @@ -16,7 +16,6 @@ export function confirm_unstar_all_messages() { parent: modal_parent, html_heading: $t_html({defaultMessage: "Unstar all messages"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: message_flags.unstar_all_messages, }); } @@ -41,7 +40,6 @@ export function confirm_unstar_all_messages_in_topic(stream_id, topic) { parent: modal_parent, html_heading: $t_html({defaultMessage: "Unstar messages in topic"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click, }); } diff --git a/static/js/stream_create.js b/static/js/stream_create.js index f2e04f1068..9ad293a74d 100644 --- a/static/js/stream_create.js +++ b/static/js/stream_create.js @@ -441,7 +441,6 @@ export function set_up_handlers() { parent: modal_parent, html_heading: $t_html({defaultMessage: "Large number of subscribers"}), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: () => { create_stream(); }, diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js index 3435c92dd6..43be5e71c2 100644 --- a/static/js/stream_edit.js +++ b/static/js/stream_edit.js @@ -899,7 +899,6 @@ export function initialize() { {stream_name: sub.name}, ), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: remove_user_from_private_stream, fade: true, }); @@ -968,7 +967,6 @@ export function initialize() { ), help_link: "/help/archive-a-stream", html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: do_archive_stream, fade: true, }); diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js index 1114004cb8..3da54afda3 100644 --- a/static/js/stream_popover.js +++ b/static/js/stream_popover.js @@ -671,7 +671,6 @@ export function register_topic_handlers() { html_heading: $t_html({defaultMessage: "Delete topic"}), help_link: "/help/delete-a-topic", html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: () => { message_edit.delete_topic(stream_id, topic); }, diff --git a/static/js/stream_settings_ui.js b/static/js/stream_settings_ui.js index ba8aae9323..63303e756e 100644 --- a/static/js/stream_settings_ui.js +++ b/static/js/stream_settings_ui.js @@ -970,7 +970,6 @@ export function unsubscribe_from_private_stream(sub, from_stream_popover) { {stream_name: sub.name}, ), html_body, - html_submit_button: $t_html({defaultMessage: "Confirm"}), on_click: unsubscribe_from_stream, fade: true, });