mirror of https://github.com/zulip/zulip.git
web: Convert .data("user-id") to .attr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
455f8a9c53
commit
64c2d442ac
|
@ -252,7 +252,7 @@ export function initialize() {
|
|||
const {$banner_container} = get_input_info(event);
|
||||
const $invite_row = $(event.target).parents(".main-view-banner");
|
||||
|
||||
const user_id = Number.parseInt($invite_row.data("user-id"), 10);
|
||||
const user_id = Number($invite_row.attr("data-user-id"));
|
||||
const stream_id = Number($invite_row.attr("data-stream-id"));
|
||||
|
||||
function success() {
|
||||
|
|
|
@ -223,7 +223,7 @@ export function warn_if_mentioning_unsubscribed_user(
|
|||
);
|
||||
|
||||
const existing_invites = [...$existing_invites_area].map((user_row) =>
|
||||
Number.parseInt($(user_row).data("user-id"), 10),
|
||||
Number($(user_row).attr("data-user-id")),
|
||||
);
|
||||
|
||||
const can_subscribe_other_users = settings_data.user_can_subscribe_other_users();
|
||||
|
|
|
@ -441,7 +441,7 @@ function handle_deactivation($tbody) {
|
|||
e.stopPropagation();
|
||||
|
||||
const $row = $(e.target).closest(".user_row");
|
||||
const user_id = $row.data("user-id");
|
||||
const user_id = Number($row.attr("data-user-id"));
|
||||
|
||||
function handle_confirm() {
|
||||
const url = "/json/users/" + encodeURIComponent(user_id);
|
||||
|
|
|
@ -79,7 +79,7 @@ function compare_by_name(a, b) {
|
|||
|
||||
export function get_user_id_if_user_profile_modal_open() {
|
||||
if (modals.any_active() && modals.active_modal() === "#user-profile-modal") {
|
||||
const user_id = $("#user-profile-modal").data("user-id");
|
||||
const user_id = Number($("#user-profile-modal").attr("data-user-id"));
|
||||
return user_id;
|
||||
}
|
||||
return undefined;
|
||||
|
@ -675,7 +675,7 @@ export function show_edit_bot_info_modal(user_id, $container) {
|
|||
$("#bot-edit-form").on("click", ".deactivate_bot_button", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const bot_id = $("#bot-edit-form").data("user-id");
|
||||
const bot_id = Number($("#bot-edit-form").attr("data-user-id"));
|
||||
function handle_confirm() {
|
||||
const url = "/json/bots/" + encodeURIComponent(bot_id);
|
||||
dialog_widget.submit_api_request(channel.del, url, {});
|
||||
|
@ -687,7 +687,7 @@ export function show_edit_bot_info_modal(user_id, $container) {
|
|||
$("#bot-edit-form").on("click", ".reactivate_user_button", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const user_id = $("#bot-edit-form").data("user-id");
|
||||
const user_id = Number($("#bot-edit-form").attr("data-user-id"));
|
||||
function handle_confirm() {
|
||||
const url = "/json/users/" + encodeURIComponent(user_id) + "/reactivate";
|
||||
dialog_widget.submit_api_request(channel.post, url, {});
|
||||
|
@ -787,7 +787,7 @@ export function show_edit_user_info_modal(user_id, $container) {
|
|||
$("#edit-user-form").on("click", ".deactivate_user_button", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const user_id = $("#edit-user-form").data("user-id");
|
||||
const user_id = Number($("#edit-user-form").attr("data-user-id"));
|
||||
function handle_confirm() {
|
||||
const url = "/json/users/" + encodeURIComponent(user_id);
|
||||
dialog_widget.submit_api_request(channel.del, url, {});
|
||||
|
@ -799,7 +799,7 @@ export function show_edit_user_info_modal(user_id, $container) {
|
|||
$("#edit-user-form").on("click", ".reactivate_user_button", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const user_id = $("#edit-user-form").data("user-id");
|
||||
const user_id = Number($("#edit-user-form").attr("data-user-id"));
|
||||
function handle_confirm() {
|
||||
const url = "/json/users/" + encodeURIComponent(user_id) + "/reactivate";
|
||||
dialog_widget.submit_api_request(channel.post, url, {});
|
||||
|
|
|
@ -732,10 +732,7 @@ test_ui("warn_if_mentioning_unsubscribed_user", ({override, mock_template}) => {
|
|||
|
||||
// Simulate that the row was added to the DOM.
|
||||
const $warning_row = $("#compose_banners .recipient_not_subscribed");
|
||||
$warning_row.data = (key) =>
|
||||
({
|
||||
"user-id": "34",
|
||||
})[key];
|
||||
$warning_row.attr("data-user-id", "34");
|
||||
$warning_row.attr("data-stream-id", "111");
|
||||
$("#compose_banners .recipient_not_subscribed").length = 1;
|
||||
$("#compose_banners .recipient_not_subscribed")[0] = $warning_row;
|
||||
|
|
Loading…
Reference in New Issue