From a90f7cce6fd3af4be142a96adaf0f3ef6ef1a884 Mon Sep 17 00:00:00 2001 From: Kislay Verma Date: Fri, 5 Apr 2024 00:19:25 +0530 Subject: [PATCH] settings: Add tooltip to clarify invalid Jitsi URL. This commit adds a tooltip in organization settings, when the save button is disabled due to invalid Jitsi URL. Fixes #27511. Co-authored-by: Angelica Ferlin Co-authored-by: Peterson Linn Co-authored-by: Kislay Verma --- tools/lib/capitalization.py | 1 + web/src/settings_components.ts | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py index a2c521e401..c130abe26b 100644 --- a/tools/lib/capitalization.py +++ b/tools/lib/capitalization.py @@ -27,6 +27,7 @@ IGNORED_PHRASES = [ r"Inbox", r"IP", r"JSON", + r"Jitsi", r"Kerberos", r"LinkedIn", r"LDAP", diff --git a/web/src/settings_components.ts b/web/src/settings_components.ts index 01b8c6c315..46b8b3badd 100644 --- a/web/src/settings_components.ts +++ b/web/src/settings_components.ts @@ -1,6 +1,6 @@ import $ from "jquery"; import assert from "minimalistic-assert"; -import type {Props} from "tippy.js"; +import type {PopperElement, Props} from "tippy.js"; import tippy from "tippy.js"; import render_compose_banner from "../templates/compose_banner/compose_banner.hbs"; @@ -916,6 +916,23 @@ function enable_or_disable_save_button($subsection_elem: JQuery): void { disable_save_btn = should_disable_save_button_for_time_limit_settings(time_limit_settings); } else if ($subsection_elem.attr("id") === "org-other-settings") { disable_save_btn = should_disable_save_button_for_jitsi_server_url_setting(); + const $button_wrapper = $subsection_elem.find(".subsection-changes-save"); + const tippy_instance = $button_wrapper[0]._tippy; + if (disable_save_btn) { + // avoid duplication of tippy + if (!tippy_instance) { + const opts: Partial = {placement: "top"}; + initialize_disable_btn_hint_popover( + $button_wrapper, + $t({defaultMessage: "Cannot save invalid Jitsi server URL."}), + opts, + ); + } + } else { + if (tippy_instance) { + tippy_instance.destroy(); + } + } } $subsection_elem.find(".subsection-changes-save button").prop("disabled", disable_save_btn);