mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
web: Convert .data("stream-id") to .attr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
bc9a7ef274
commit
455f8a9c53
@@ -253,7 +253,7 @@ export function initialize() {
|
|||||||
const $invite_row = $(event.target).parents(".main-view-banner");
|
const $invite_row = $(event.target).parents(".main-view-banner");
|
||||||
|
|
||||||
const user_id = Number.parseInt($invite_row.data("user-id"), 10);
|
const user_id = Number.parseInt($invite_row.data("user-id"), 10);
|
||||||
const stream_id = Number.parseInt($invite_row.data("stream-id"), 10);
|
const stream_id = Number($invite_row.attr("data-stream-id"));
|
||||||
|
|
||||||
function success() {
|
function success() {
|
||||||
$invite_row.remove();
|
$invite_row.remove();
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ export function warn_if_private_stream_is_linked(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const existing_stream_warnings = [...$existing_stream_warnings_area].map((stream_row) =>
|
const existing_stream_warnings = [...$existing_stream_warnings_area].map((stream_row) =>
|
||||||
Number.parseInt($(stream_row).data("stream-id"), 10),
|
Number($(stream_row).attr("data-stream-id")),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!existing_stream_warnings.includes(linked_stream.stream_id)) {
|
if (!existing_stream_warnings.includes(linked_stream.stream_id)) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ function get_chosen_default_streams() {
|
|||||||
// Return the set of stream id's of streams chosen in the default stream modal.
|
// Return the set of stream id's of streams chosen in the default stream modal.
|
||||||
return new Set(
|
return new Set(
|
||||||
$("#default-stream-choices .choice-row .dropdown_widget_value")
|
$("#default-stream-choices .choice-row .dropdown_widget_value")
|
||||||
.map((_i, elem) => $(elem).data("stream-id")?.toString())
|
.map((_i, elem) => Number($(elem).attr("data-stream-id")).toString())
|
||||||
.get(),
|
.get(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ function create_choice_row() {
|
|||||||
const $stream_dropdown_widget = $(`#${CSS.escape(stream_dropdown_widget_name)}_widget`);
|
const $stream_dropdown_widget = $(`#${CSS.escape(stream_dropdown_widget_name)}_widget`);
|
||||||
const $stream_name = $stream_dropdown_widget.find(".dropdown_widget_value");
|
const $stream_name = $stream_dropdown_widget.find(".dropdown_widget_value");
|
||||||
$stream_name.text(selected_stream_name);
|
$stream_name.text(selected_stream_name);
|
||||||
$stream_name.data("stream-id", selected_stream_id);
|
$stream_name.attr("data-stream-id", selected_stream_id);
|
||||||
|
|
||||||
add_choice_row($stream_dropdown_widget);
|
add_choice_row($stream_dropdown_widget);
|
||||||
dropdown.hide();
|
dropdown.hide();
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ export function initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function do_archive_stream() {
|
function do_archive_stream() {
|
||||||
const stream_id = $(".dialog_submit_button").data("stream-id");
|
const stream_id = Number($(".dialog_submit_button").attr("data-stream-id"));
|
||||||
if (!stream_id) {
|
if (!stream_id) {
|
||||||
ui_report.client_error(
|
ui_report.client_error(
|
||||||
$t_html({defaultMessage: "Invalid channel ID"}),
|
$t_html({defaultMessage: "Invalid channel ID"}),
|
||||||
@@ -692,7 +692,9 @@ export function initialize() {
|
|||||||
const $save_button = $(e.currentTarget);
|
const $save_button = $(e.currentTarget);
|
||||||
const $subsection_elem = $save_button.closest(".settings-subsection-parent");
|
const $subsection_elem = $save_button.closest(".settings-subsection-parent");
|
||||||
|
|
||||||
const stream_id = $save_button.closest(".subscription_settings.show").data("stream-id");
|
const stream_id = Number(
|
||||||
|
$save_button.closest(".subscription_settings.show").attr("data-stream-id"),
|
||||||
|
);
|
||||||
const sub = sub_store.get(stream_id);
|
const sub = sub_store.get(stream_id);
|
||||||
const data = settings_org.populate_data_for_request($subsection_elem, false, sub);
|
const data = settings_org.populate_data_for_request($subsection_elem, false, sub);
|
||||||
|
|
||||||
@@ -724,7 +726,9 @@ export function initialize() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
const stream_id = $(e.target).closest(".subscription_settings.show").data("stream-id");
|
const stream_id = Number(
|
||||||
|
$(e.target).closest(".subscription_settings.show").attr("data-stream-id"),
|
||||||
|
);
|
||||||
const sub = sub_store.get(stream_id);
|
const sub = sub_store.get(stream_id);
|
||||||
|
|
||||||
const $subsection = $(e.target).closest(".settings-subsection-parent");
|
const $subsection = $(e.target).closest(".settings-subsection-parent");
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ export function update_notification_setting_checkbox(notification_name) {
|
|||||||
if (!$stream_row.length) {
|
if (!$stream_row.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const stream_id = $stream_row.data("stream-id");
|
const stream_id = Number($stream_row.attr("data-stream-id"));
|
||||||
$(`#${CSS.escape(notification_name)}_${CSS.escape(stream_id)}`).prop(
|
$(`#${CSS.escape(notification_name)}_${CSS.escape(stream_id)}`).prop(
|
||||||
"checked",
|
"checked",
|
||||||
stream_data.receives_notifications(stream_id, notification_name),
|
stream_data.receives_notifications(stream_id, notification_name),
|
||||||
|
|||||||
@@ -647,10 +647,7 @@ test_ui("warn_if_private_stream_is_linked", ({mock_template}) => {
|
|||||||
|
|
||||||
// Simulate that the row was added to the DOM.
|
// Simulate that the row was added to the DOM.
|
||||||
const $warning_row = $("#compose_banners .private_stream_warning");
|
const $warning_row = $("#compose_banners .private_stream_warning");
|
||||||
$warning_row.data = (key) =>
|
$warning_row.attr("data-stream-id", "22");
|
||||||
({
|
|
||||||
"stream-id": "22",
|
|
||||||
})[key];
|
|
||||||
$("#compose_banners .private_stream_warning").length = 1;
|
$("#compose_banners .private_stream_warning").length = 1;
|
||||||
$("#compose_banners .private_stream_warning")[0] = $warning_row;
|
$("#compose_banners .private_stream_warning")[0] = $warning_row;
|
||||||
|
|
||||||
@@ -738,8 +735,8 @@ test_ui("warn_if_mentioning_unsubscribed_user", ({override, mock_template}) => {
|
|||||||
$warning_row.data = (key) =>
|
$warning_row.data = (key) =>
|
||||||
({
|
({
|
||||||
"user-id": "34",
|
"user-id": "34",
|
||||||
"stream-id": "111",
|
|
||||||
})[key];
|
})[key];
|
||||||
|
$warning_row.attr("data-stream-id", "111");
|
||||||
$("#compose_banners .recipient_not_subscribed").length = 1;
|
$("#compose_banners .recipient_not_subscribed").length = 1;
|
||||||
$("#compose_banners .recipient_not_subscribed")[0] = $warning_row;
|
$("#compose_banners .recipient_not_subscribed")[0] = $warning_row;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user