eslint: Fix no-jquery/no-append-html errors that need no test changes.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-04-03 15:18:17 -07:00 committed by Tim Abbott
parent 01860422af
commit 382af5f79f
41 changed files with 170 additions and 151 deletions

View File

@ -34,5 +34,5 @@ export function initialize(): void {
zulip_merge_base: realm.zulip_merge_base,
is_fork: realm.zulip_merge_base && realm.zulip_merge_base !== realm.zulip_version,
});
$("#about-zulip-modal-container").append(rendered_about_zulip);
$("#about-zulip-modal-container").append($(rendered_about_zulip));
}

View File

@ -76,14 +76,16 @@ function insert_tip_box() {
if (current_user.is_admin) {
return;
}
const tip_box = render_settings_organization_settings_tip({is_admin: current_user.is_admin});
const tip_box_html = render_settings_organization_settings_tip({
is_admin: current_user.is_admin,
});
$(".organization-box")
.find(".settings-section")
.not("#emoji-settings")
.not("#organization-auth-settings")
.not("#admin-bot-list")
.not("#admin-invites-list")
.prepend(tip_box);
.prepend($(tip_box_html));
}
function get_realm_level_notification_settings(options) {

View File

@ -238,7 +238,7 @@ class Typeahead<ItemType extends string | object> {
this.sorter = options.sorter;
this.highlighter_html = options.highlighter_html;
this.updater = options.updater ?? ((items) => this.defaultUpdater(items));
this.$container = $(CONTAINER_HTML).appendTo(options.parentElement ?? "body");
this.$container = $(CONTAINER_HTML).appendTo($(options.parentElement ?? "body"));
this.$menu = $(MENU_HTML).appendTo(this.$container);
this.$header = $(HEADER_ELEMENT_HTML).appendTo(this.$container);
this.source = options.source;
@ -414,7 +414,7 @@ class Typeahead<ItemType extends string | object> {
const option_label_html = this.option_label(matching_items, item);
if (option_label_html) {
$item_html.append(option_label_html).addClass("typeahead-option-label");
$item_html.append($(option_label_html)).addClass("typeahead-option-label");
}
return $i;
});

View File

@ -292,20 +292,18 @@ export class BuddyList extends BuddyListConf {
matching_view_empty_list_message,
);
if ($("#buddy-list-users-matching-view .empty-list-message").length) {
const empty_list_widget = render_empty_list_widget_for_list({
const empty_list_widget_html = render_empty_list_widget_for_list({
matching_view_empty_list_message,
});
$("#buddy-list-users-matching-view").empty();
$("#buddy-list-users-matching-view").append(empty_list_widget);
$("#buddy-list-users-matching-view").html(empty_list_widget_html);
}
$("#buddy-list-other-users").data("search-results-empty", other_users_empty_list_message);
if ($("#buddy-list-other-users .empty-list-message").length) {
const empty_list_widget = render_empty_list_widget_for_list({
const empty_list_widget_html = render_empty_list_widget_for_list({
other_users_empty_list_message,
});
$("#buddy-list-other-users").empty();
$("#buddy-list-other-users").append(empty_list_widget);
$("#buddy-list-other-users").html(empty_list_widget_html);
}
}
@ -336,23 +334,27 @@ export class BuddyList extends BuddyListConf {
}
$("#buddy-list-users-matching-view-container .buddy-list-subsection-header").append(
render_section_header({
id: "buddy-list-users-matching-view-section-heading",
header_text,
user_count: get_formatted_sub_count(subscriber_count),
toggle_class: "toggle-users-matching-view",
is_collapsed: this.users_matching_view_is_collapsed,
}),
$(
render_section_header({
id: "buddy-list-users-matching-view-section-heading",
header_text,
user_count: get_formatted_sub_count(subscriber_count),
toggle_class: "toggle-users-matching-view",
is_collapsed: this.users_matching_view_is_collapsed,
}),
),
);
$("#buddy-list-other-users-container .buddy-list-subsection-header").append(
render_section_header({
id: "buddy-list-other-users-section-heading",
header_text: $t({defaultMessage: "Others"}),
user_count: get_formatted_sub_count(other_users_count),
toggle_class: "toggle-other-users",
is_collapsed: this.other_users_is_collapsed,
}),
$(
render_section_header({
id: "buddy-list-other-users-section-heading",
header_text: $t({defaultMessage: "Others"}),
user_count: get_formatted_sub_count(other_users_count),
toggle_class: "toggle-other-users",
is_collapsed: this.other_users_is_collapsed,
}),
),
);
}

View File

@ -84,7 +84,7 @@ function construct_copy_div($div, start_id, end_id) {
// so we have to add new recipient's bar to final copied message
// and wouldn't forget to add start_recipient's bar at the beginning of final message
if (recipient_row_id !== last_recipient_row_id) {
$div.append(construct_recipient_header($row));
construct_recipient_header($row).appendTo($div);
last_recipient_row_id = recipient_row_id;
should_include_start_recipient_header = true;
}
@ -99,7 +99,7 @@ function construct_copy_div($div, start_id, end_id) {
}
if (should_include_start_recipient_header) {
$div.prepend(construct_recipient_header($start_row));
construct_recipient_header($start_row).prependTo($div);
}
}

View File

@ -64,7 +64,7 @@ export function append_custom_profile_fields(element_id, user_id) {
for_manage_user_modal: element_id === "#edit-user-form .custom-profile-field-form",
is_empty_required_field: field.required && !field_value.value,
});
$(element_id).append(html);
$(element_id).append($(html));
}
}

View File

@ -20,7 +20,7 @@ export function insert_demo_organization_warning() {
is_owner: current_user.is_owner,
days_remaining,
});
$(".organization-box").find(".settings-section").prepend(rendered_demo_organization_warning);
$(".organization-box").find(".settings-section").prepend($(rendered_demo_organization_warning));
}
export function handle_demo_organization_conversion() {

View File

@ -161,7 +161,7 @@ export function launch() {
draft_lifetime: drafts.DRAFT_LIFETIME,
});
const $drafts_table = $("#drafts_table");
$drafts_table.append(rendered);
$drafts_table.append($(rendered));
if ($("#drafts_table .overlay-message-row").length > 0) {
$("#drafts_table .no-drafts").hide();
// Update possible dynamic elements.

View File

@ -259,9 +259,9 @@ function insert_hotspot_into_DOM(hotspot: Hotspot): void {
setTimeout(() => {
if (!hotspot.has_trigger) {
$("body").prepend(hotspot_icon_HTML);
$("body").prepend($(hotspot_icon_HTML));
}
$("body").prepend(hotspot_overlay_HTML);
$("body").prepend($(hotspot_overlay_HTML));
if (hotspot.has_trigger || place_icon(hotspot)) {
place_popover(hotspot);
}

View File

@ -207,7 +207,7 @@ function insert_dms(keys_to_insert) {
// If we need to insert at the top, we do it separately to avoid edge case in loop below.
if (keys_to_insert.includes(sorted_keys[0])) {
$("#inbox-direct-messages-container").prepend(
render_inbox_row(dms_dict.get(sorted_keys[0])),
$(render_inbox_row(dms_dict.get(sorted_keys[0]))),
);
}
@ -218,7 +218,7 @@ function insert_dms(keys_to_insert) {
if (keys_to_insert.includes(key)) {
const $previous_row = get_row_from_conversation_key(sorted_keys[i - 1]);
$previous_row.after(render_inbox_row(dms_dict.get(key)));
$previous_row.after($(render_inbox_row(dms_dict.get(key))));
}
}
}
@ -241,7 +241,7 @@ function rerender_dm_inbox_row_if_needed(new_dm_data, old_dm_data, dm_keys_to_in
for (const property in new_dm_data) {
if (new_dm_data[property] !== old_dm_data[property]) {
const $rendered_row = get_row_from_conversation_key(new_dm_data.conversation_key);
$rendered_row.replaceWith(render_inbox_row(new_dm_data));
$rendered_row.replaceWith($(render_inbox_row(new_dm_data)));
return;
}
}
@ -294,7 +294,7 @@ function rerender_stream_inbox_header_if_needed(new_stream_data, old_stream_data
for (const property in new_stream_data) {
if (new_stream_data[property] !== old_stream_data[property]) {
const $rendered_row = get_stream_header_row(new_stream_data.stream_id);
$rendered_row.replaceWith(render_inbox_row(new_stream_data));
$rendered_row.replaceWith($(render_inbox_row(new_stream_data)));
return;
}
}
@ -333,7 +333,7 @@ function insert_stream(stream_id, topic_dict) {
});
if (stream_index === 0) {
$("#inbox-streams-container").prepend(rendered_stream);
$("#inbox-streams-container").prepend($(rendered_stream));
} else {
const previous_stream_key = sorted_stream_keys[stream_index - 1];
$(rendered_stream).insertAfter(get_stream_container(previous_stream_key));
@ -349,7 +349,7 @@ function insert_topics(keys, stream_key) {
const $stream = get_stream_container(stream_key);
$stream
.find(".inbox-topic-container")
.prepend(render_inbox_row(stream_topics_data.get(sorted_keys[0])));
.prepend($(render_inbox_row(stream_topics_data.get(sorted_keys[0]))));
}
for (const [i, key] of sorted_keys.entries()) {
@ -359,7 +359,7 @@ function insert_topics(keys, stream_key) {
if (keys.includes(key)) {
const $previous_row = get_row_from_conversation_key(sorted_keys[i - 1]);
$previous_row.after(render_inbox_row(stream_topics_data.get(key)));
$previous_row.after($(render_inbox_row(stream_topics_data.get(key))));
}
}
}
@ -380,7 +380,7 @@ function rerender_topic_inbox_row_if_needed(new_topic_data, old_topic_data, topi
for (const property in new_topic_data) {
if (new_topic_data[property] !== old_topic_data[property]) {
const $rendered_row = get_row_from_conversation_key(new_topic_data.conversation_key);
$rendered_row.replaceWith(render_inbox_row(new_topic_data));
$rendered_row.replaceWith($(render_inbox_row(new_topic_data)));
return;
}
}

View File

@ -121,10 +121,10 @@ export function show_generate_integration_url_modal(api_key: string): void {
};
});
events_with_ids?.sort((a, b) => a.event.localeCompare(b.event));
const events = render_integration_events({
const events_html = render_integration_events({
events: events_with_ids,
});
$("#integrations-event-options").empty().append(events);
$("#integrations-event-options").html(events_html);
}
const params = new URLSearchParams({api_key});

View File

@ -252,10 +252,9 @@ function display_image(payload: Payload): void {
$(".image-preview, .media-actions, .media-description, .download, .lightbox-zoom-reset").show();
const $img_container = $("#lightbox_overlay .image-preview > .zoom-element");
const img = new Image();
img.src = payload.source;
const $img = $("<img>").attr("src", payload.source);
$img_container.empty();
$img_container.append(img).show();
$img_container.append($img).show();
const filename = payload.url?.split("/").pop();
$(".media-description .title")
@ -561,7 +560,7 @@ function remove_video_players(): void {
export function initialize(): void {
// Renders the DOM for the lightbox.
const rendered_lightbox_overlay = render_lightbox_overlay();
$("body").append(rendered_lightbox_overlay);
$("body").append($(rendered_lightbox_overlay));
// Bind the pan/zoom control the newly created element.
const pan_zoom_control = new PanZoomControl(

View File

@ -224,7 +224,7 @@ export function render_empty_list_message_if_needed(
return;
}
let empty_list_widget;
let empty_list_widget_html;
if ($container.is("table, tbody")) {
let $table = $container;
@ -233,17 +233,17 @@ export function render_empty_list_message_if_needed(
}
const column_count = get_column_count_for_table($table);
empty_list_widget = render_empty_list_widget_for_table({
empty_list_widget_html = render_empty_list_widget_for_table({
empty_list_message,
column_count,
});
} else {
empty_list_widget = render_empty_list_widget_for_list({
empty_list_widget_html = render_empty_list_widget_for_list({
empty_list_message,
});
}
$container.append(empty_list_widget);
$container.append($(empty_list_widget_html));
}
// @params
@ -512,10 +512,10 @@ export function create<Key, Item = Key>(
const rendered_row = opts.modifier_html(item, meta.filter_value);
if (insert_index === meta.filtered_list.length - 1) {
const $target_row = opts.html_selector!(meta.filtered_list[insert_index - 1]);
$target_row.after(rendered_row);
$target_row.after($(rendered_row));
} else {
const $target_row = opts.html_selector!(meta.filtered_list[insert_index + 1]);
$target_row.before(rendered_row);
$target_row.before($(rendered_row));
}
widget.increase_rendered_offset();
}

View File

@ -94,8 +94,7 @@ function get_display_stream_name(stream_id: number): string {
}
export function fetch_and_render_message_history(message: Message): void {
$("#message-edit-history-overlay-container").empty();
$("#message-edit-history-overlay-container").append(render_message_history_overlay());
$("#message-edit-history-overlay-container").html(render_message_history_overlay());
open_overlay();
void channel.get({
url: "/json/messages/" + message.id + "/history",
@ -211,11 +210,11 @@ export function fetch_and_render_message_history(message: Message): void {
}
}
}
const rendered_list: string = render_message_edit_history({
const rendered_list_html = render_message_edit_history({
edited_messages: content_edit_history,
});
$("#message-history-overlay").attr("data-message-id", message.id);
$("#message-history-overlay .overlay-messages-list").append(rendered_list);
$("#message-history-overlay .overlay-messages-list").append($(rendered_list_html));
// Pass the history through rendered_markdown.ts
// to update dynamic_elements in the content.

View File

@ -745,7 +745,7 @@ export class MessageListView {
$message_rows.find(".message_inline_image img").on("error", (e) => {
$(e.target)
.closest(".message_inline_image")
.replaceWith(render_login_to_view_image_button());
.replaceWith($(render_login_to_view_image_button()));
});
}
}

View File

@ -90,7 +90,8 @@ export function all_rendered_message_lists(): MessageList[] {
export function all_rendered_row_for_message_id(message_id: number): JQuery {
let $rows = $();
for (const msg_list of all_rendered_message_lists()) {
$rows = $rows.add(msg_list.get_row(message_id));
const $row = msg_list.get_row(message_id);
$rows = $rows.add($row);
}
return $rows;
}

View File

@ -99,9 +99,7 @@ export function colorize_message_view_header(): void {
function append_and_display_title_area(context: MessageViewHeaderContext): void {
const $message_view_header_elem = $("#message_view_header");
$message_view_header_elem.empty();
const rendered = render_message_view_header(context);
$message_view_header_elem.append(rendered);
$message_view_header_elem.html(render_message_view_header(context));
if (context.stream_settings_link) {
colorize_message_view_header();
}

View File

@ -4,9 +4,9 @@ import SortableJS from "sortablejs";
import render_poll_modal_option from "../templates/poll_modal_option.hbs";
function create_option_row($last_option_row_input: JQuery): void {
const row = render_poll_modal_option();
const row_html = render_poll_modal_option();
const $row_container = $last_option_row_input.closest(".simplebar-content");
$row_container.append(row);
$row_container.append($(row_html));
}
function add_option_row(e: JQuery.TriggeredEvent): void {

View File

@ -141,7 +141,7 @@ $(() => {
errorPlacement($error: JQuery) {
$(".email-frontend-error").empty();
$("#send_confirm .alert.email-backend-error").remove();
$error.appendTo(".email-frontend-error").addClass("text-error");
$error.appendTo($(".email-frontend-error")).addClass("text-error");
},
success() {
$("#errors").empty();

View File

@ -158,11 +158,13 @@ export default function render_tabs(contributors: Contributor[]): void {
$("#tab-total .contributors-grid").html(total_tab_html);
$("#tab-total").prepend(
total_count_template({
contributor_count: contributors_list.length,
tab_name: "total",
hundred_plus_contributor_count: hundred_plus_total_contributors.length,
}),
$(
total_count_template({
contributor_count: contributors_list.length,
tab_name: "total",
hundred_plus_contributor_count: hundred_plus_total_contributors.length,
}),
),
);
for (const tab_name of all_tab_names) {
@ -215,12 +217,14 @@ export default function render_tabs(contributors: Contributor[]): void {
(repo_name) => `https://github.com/zulip/${repo_name}`,
);
$(`#tab-${CSS.escape(tab_name)}`).prepend(
count_template({
contributor_count,
repo_list,
repo_url_list,
hundred_plus_contributor_count,
}),
$(
count_template({
contributor_count,
repo_list,
repo_url_list,
hundred_plus_contributor_count,
}),
),
);
loaded_tabs.push(tab_name);

View File

@ -87,8 +87,7 @@ function format(scheduled_messages) {
}
export function launch() {
$("#scheduled_messages_overlay_container").empty();
$("#scheduled_messages_overlay_container").append(render_scheduled_messages_overlay());
$("#scheduled_messages_overlay_container").html(render_scheduled_messages_overlay());
overlays.open_overlay({
name: "scheduled",
$overlay: $("#scheduled_messages_overlay"),
@ -101,7 +100,7 @@ export function launch() {
scheduled_messages_data: format(scheduled_messages.scheduled_messages_data),
});
const $messages_list = $("#scheduled_messages_overlay .overlay-messages-list");
$messages_list.append(rendered_list);
$messages_list.append($(rendered_list));
const first_element_id = keyboard_handling_context.get_items_ids()[0];
messages_overlay_ui.set_initial_element(first_element_id, keyboard_handling_context);
@ -116,7 +115,7 @@ export function rerender() {
});
const $messages_list = $("#scheduled_messages_overlay .overlay-messages-list");
$messages_list.find(".scheduled-message-row").remove();
$messages_list.append(rendered_list);
$messages_list.append($(rendered_list));
}
export function remove_scheduled_message_id(scheduled_msg_id) {

View File

@ -36,7 +36,7 @@ export function open_send_later_menu() {
// Only show send later options that are possible today.
const date = new Date();
const filtered_send_opts = scheduled_messages.get_filtered_send_opts(date);
$("body").append(render_send_later_modal(filtered_send_opts));
$("body").append($(render_send_later_modal(filtered_send_opts)));
let interval;
modals.open("send_later_modal", {
@ -232,6 +232,8 @@ export function update_send_later_options() {
const now = new Date();
if (should_update_send_later_options(now)) {
const filtered_send_opts = scheduled_messages.get_filtered_send_opts(now);
$("#send_later_options").replaceWith(render_send_later_modal_options(filtered_send_opts));
$("#send_later_options").replaceWith(
$(render_send_later_modal_options(filtered_send_opts)),
);
}
}

View File

@ -174,7 +174,7 @@ export function initialize() {
show_emoji_settings_lock: !settings_data.user_can_add_custom_emoji(),
can_create_new_bots: settings_bots.can_create_new_bots(),
});
$("#settings_overlay_container").append(rendered_settings_overlay);
$("#settings_overlay_container").append($(rendered_settings_overlay));
$("#settings_overlay_container").on("click", (e) => {
if (!modals.any_active()) {

View File

@ -360,7 +360,7 @@ export function set_up() {
};
$("#api_key_button").on("click", (e) => {
$("body").append(render_settings_api_key_modal());
$("body").append($(render_settings_api_key_modal()));
setup_api_key_modal();
$("#api_key_status").hide();
modals.open("api_key_modal", {

View File

@ -353,7 +353,7 @@ export function set_up() {
},
});
$("#bot-settings .tab-container").prepend(toggler.get());
toggler.get().prependTo($("#bot-settings .tab-container"));
toggler.goto("active-bots");
render_bots();

View File

@ -818,7 +818,7 @@ export function save_discard_widget_status_handler(
stream_id: sub.stream_id,
};
$("#stream_permission_settings .stream-permissions-warning-banner").append(
render_compose_banner(context),
$(render_compose_banner(context)),
);
} else {
$("#stream_permission_settings .stream-permissions-warning-banner").empty();

View File

@ -39,15 +39,17 @@ function rerender_ui() {
for (const stream of unmatched_streams) {
$unmatched_streams_table.append(
render_stream_specific_notification_row({
stream,
stream_specific_notification_settings:
settings_config.stream_specific_notification_settings,
is_disabled:
settings_config.all_notifications(user_settings)
.show_push_notifications_tooltip,
muted: muted_stream_ids.includes(stream.stream_id),
}),
$(
render_stream_specific_notification_row({
stream,
stream_specific_notification_settings:
settings_config.stream_specific_notification_settings,
is_disabled:
settings_config.all_notifications(user_settings)
.show_push_notifications_tooltip,
muted: muted_stream_ids.includes(stream.stream_id),
}),
),
);
}

View File

@ -158,8 +158,8 @@ function create_choice_row(container) {
value: get_value_for_new_option(container),
new_empty_choice_row: true,
};
const row = render_settings_profile_field_choice(context);
$(container).append(row);
const row_html = render_settings_profile_field_choice(context);
$(container).append($(row_html));
}
function clear_form_data() {
@ -417,10 +417,12 @@ function set_up_select_field_edit_form($profile_field_form, field_data) {
for (const choice of choices_data) {
$choice_list.append(
render_settings_profile_field_choice({
text: choice.text,
value: choice.value,
}),
$(
render_settings_profile_field_choice({
text: choice.text,
value: choice.value,
}),
),
);
}

View File

@ -25,9 +25,7 @@ export function populate_realm_domains_table(realm_domains: RealmDomain[]): void
for (const realm_domain of realm_domains) {
$realm_domains_table_body.append(
render_settings_admin_realm_domains_list({
realm_domain,
}),
$(render_settings_admin_realm_domains_list({realm_domain})),
);
}
}

View File

@ -38,8 +38,8 @@ function create_choice_row() {
const $container = $("#default-stream-choices");
const value = settings_profile_fields.get_value_for_new_option("#default-stream-choices");
const stream_dropdown_widget_name = `select_default_stream_${value}`;
const row = render_default_stream_choice({value, stream_dropdown_widget_name});
$container.append(row);
const row_html = render_default_stream_choice({value, stream_dropdown_widget_name});
$container.append($(row_html));
// List of non-default streams that are not yet selected.
function get_options() {

View File

@ -30,7 +30,7 @@ export function initialize() {
settings_panel_menu.set_key_handlers(toggler);
$("#settings_overlay_container .tab-container").append(toggler.get());
toggler.get().appendTo("#settings_overlay_container .tab-container");
}
// Handles the collapse/reveal of some tabs in the org settings for non-admins.

View File

@ -17,10 +17,10 @@ type RequestOpts = {
};
export function display_checkmark($elem: JQuery): void {
const check_mark = document.createElement("img");
check_mark.src = checkbox_image;
$elem.prepend(check_mark);
$(check_mark).css("width", "13px");
const $check_mark = $("<img>");
$check_mark.attr("src", checkbox_image);
$check_mark.css("width", "13px");
$elem.prepend($check_mark);
}
export const strings = {

View File

@ -33,12 +33,14 @@ export function login_to_access(empty_narrow?: boolean): void {
const realm_name = realm.realm_name;
$("body").append(
render_login_to_access_modal({
signup_link: "/register/",
login_link,
empty_narrow,
realm_name,
}),
$(
render_login_to_access_modal({
signup_link: "/register/",
login_link,
empty_narrow,
realm_name,
}),
),
);
modals.open("login_to_access_modal", {

View File

@ -260,7 +260,7 @@ export function show_settings_for(node) {
});
scroll_util.get_content_element($("#stream_settings")).html(html);
$("#stream_settings .tab-container").prepend(stream_edit_toggler.toggler.get());
stream_edit_toggler.toggler.get().prependTo("#stream_settings .tab-container");
stream_ui_updates.set_up_right_panel_section(sub);
const $edit_container = stream_settings_containers.get_edit_container(sub);

View File

@ -568,7 +568,7 @@ export function setup_page(callback) {
},
});
$("#streams_overlay_container .list-toggler-container").prepend(sort_toggler.get());
sort_toggler.get().prependTo("#streams_overlay_container .list-toggler-container");
// Reset our internal state to reflect that we're initially in
// the "Subscribed" tab if we're reopening "Stream settings".
@ -633,7 +633,7 @@ export function setup_page(callback) {
};
const rendered = render_stream_settings_overlay(template_data);
$("#streams_overlay_container").append(rendered);
$("#streams_overlay_container").append($(rendered));
render_left_panel_superset();
initialize_components();

View File

@ -305,11 +305,13 @@ export function update_stream_privacy_icon_in_settings(sub) {
const $stream_settings = stream_settings_containers.get_edit_container(sub);
$stream_settings.find(".general_settings .large-icon").replaceWith(
render_stream_privacy_icon({
invite_only: sub.invite_only,
color: sub.color,
is_web_public: sub.is_web_public,
}),
$(
render_stream_privacy_icon({
invite_only: sub.invite_only,
color: sub.color,
is_web_public: sub.is_web_public,
}),
),
);
}

View File

@ -208,7 +208,7 @@ export class TopicListWidget {
const replace_content = (html: string): void => {
this.remove();
this.$parent_elem.append(html);
this.$parent_elem.append($(html));
};
const find = (): JQuery => this.$parent_elem.find(".topic-list");

View File

@ -173,13 +173,15 @@ function initialize_navbar() {
function initialize_compose_box() {
$("#compose-container").append(
render_compose({
embedded: $("#compose").attr("data-embedded") === "",
file_upload_enabled: realm.max_file_upload_size_mib > 0,
giphy_enabled: giphy.is_giphy_enabled(),
max_stream_name_length: realm.max_stream_name_length,
max_topic_length: realm.max_topic_length,
}),
$(
render_compose({
embedded: $("#compose").attr("data-embedded") === "",
file_upload_enabled: realm.max_file_upload_size_mib > 0,
giphy_enabled: giphy.is_giphy_enabled(),
max_stream_name_length: realm.max_stream_name_length,
max_topic_length: realm.max_topic_length,
}),
),
);
$(`.enter_sends_${user_settings.enter_sends}`).show();
common.adjust_mac_kbd_tags(".open_enter_sends_dialog kbd");

View File

@ -352,11 +352,13 @@ function show_user_card_popover(
$popover.addClass(get_popover_classname(template_class));
$popover_title.append(
render_user_card_popover_avatar({
// See the load_medium_avatar comment for important background.
user_avatar: people.small_avatar_url_for_person(user),
user_is_guest: user.is_guest,
}),
$(
render_user_card_popover_avatar({
// See the load_medium_avatar comment for important background.
user_avatar: people.small_avatar_url_for_person(user),
user_is_guest: user.is_guest,
}),
),
);
},
onHidden() {

View File

@ -278,7 +278,7 @@ export function show_settings_for(group) {
initialize_tooltip_for_membership_button(group.id);
}
$("#user_group_settings .tab-container").prepend(toggler.get());
toggler.get().prependTo("#user_group_settings .tab-container");
const $edit_container = get_edit_container(group);
$(".nothing-selected").hide();
@ -712,7 +712,7 @@ export function setup_page(callback) {
},
});
$("#groups_overlay_container .list-toggler-container").prepend(group_list_toggler.get());
group_list_toggler.get().prependTo("#groups_overlay_container .list-toggler-container");
}
function populate_and_fill() {
@ -721,13 +721,12 @@ export function setup_page(callback) {
max_user_group_name_length,
};
const rendered = render_user_group_settings_overlay(template_data);
const groups_overlay_html = render_user_group_settings_overlay(template_data);
const $groups_overlay_container = scroll_util.get_content_element(
$("#groups_overlay_container"),
);
$groups_overlay_container.empty();
$groups_overlay_container.append(rendered);
$groups_overlay_container.html(groups_overlay_html);
// Initially as the overlay is build with empty right panel,
// active_group_id is undefined.

View File

@ -351,7 +351,7 @@ function initialize_user_type_fields(user) {
}
export function show_user_profile_access_error_modal() {
$("body").append(render_profile_access_error_model());
$("body").append($(render_profile_access_error_model()));
// This opens the model, referencing it by it's ID('profile_access_error_model)
modals.open("profile_access_error_modal", {
@ -526,7 +526,7 @@ export function show_edit_bot_info_modal(user_id, $container) {
current_bot_owner: bot.bot_owner_id,
is_incoming_webhook_bot: bot.bot_type === INCOMING_WEBHOOK_BOT_TYPE,
});
$container.append(html_body);
$container.append($(html_body));
let avatar_widget;
const bot_type = bot.bot_type.toString();
@ -638,17 +638,21 @@ export function show_edit_bot_info_modal(user_id, $container) {
if (bot_type === OUTGOING_WEBHOOK_BOT_TYPE) {
$("#service_data").append(
render_settings_edit_outgoing_webhook_service({
service,
}),
$(
render_settings_edit_outgoing_webhook_service({
service,
}),
),
);
$("#edit_service_interface").val(service.interface);
}
if (bot_type === EMBEDDED_BOT_TYPE) {
$("#service_data").append(
render_settings_edit_embedded_bot_service({
service,
}),
$(
render_settings_edit_embedded_bot_service({
service,
}),
),
);
}
@ -749,7 +753,7 @@ export function show_edit_user_info_modal(user_id, $container) {
is_active,
});
$container.append(html_body);
$container.append($(html_body));
// Set role dropdown and fields user pills
$("#user-role-select").val(person.role);
if (!current_user.is_owner) {