From 94fe762ea59598047c3013b60a9fcf25ca6e5bc5 Mon Sep 17 00:00:00 2001 From: palashb01 Date: Wed, 16 Aug 2023 18:30:29 +0530 Subject: [PATCH] user_profile: Add function to return the user profile modal id if open. --- web/src/user_profile.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/src/user_profile.js b/web/src/user_profile.js index 47fe1cac3e..a10870386f 100644 --- a/web/src/user_profile.js +++ b/web/src/user_profile.js @@ -32,6 +32,14 @@ function compare_by_name(a, b) { return util.strcmp(a.name, b.name); } +export function get_user_id_if_user_profile_modal_open() { + if (overlays.is_modal_open() && overlays.active_modal() === "#user-profile-modal") { + const user_id = $("#user-profile-modal").data("user-id"); + return user_id; + } + return undefined; +} + function initialize_bot_owner(element_id, bot_id) { const user_pills = new Map(); const bot = people.get_by_user_id(bot_id);