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 <angelica.ferlin@gmail.com>
Co-authored-by: Peterson Linn <linn@pajp.net>
Co-authored-by: Kislay Verma <kislayuv27@gmail.com>
This commit is contained in:
Kislay Verma 2024-04-05 00:19:25 +05:30 committed by Tim Abbott
parent 5f35384c80
commit a90f7cce6f
2 changed files with 19 additions and 1 deletions

View File

@ -27,6 +27,7 @@ IGNORED_PHRASES = [
r"Inbox",
r"IP",
r"JSON",
r"Jitsi",
r"Kerberos",
r"LinkedIn",
r"LDAP",

View File

@ -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<PopperElement>(".subsection-changes-save");
const tippy_instance = $button_wrapper[0]._tippy;
if (disable_save_btn) {
// avoid duplication of tippy
if (!tippy_instance) {
const opts: Partial<Props> = {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);