message_list_tooltips: Avoid showing undefined.

If the template_id of the message_control_button
is undefined, we do not render the tooltip at all.
This might happen, for example,
when a message is past its editable period and
the edit button is not displayed.
This commit is contained in:
Kislay Verma
2025-03-12 11:41:43 +05:30
committed by Tim Abbott
parent f0e15cff77
commit 28a277027b

View File

@@ -232,9 +232,14 @@ export function initialize(): void {
if (tippy_content !== undefined) { if (tippy_content !== undefined) {
instance.setContent(tippy_content); instance.setContent(tippy_content);
} else { } else {
const $template = $(`#${CSS.escape($elem.attr("data-tooltip-template-id")!)}`); const template_id = $elem.attr("data-tooltip-template-id");
if (template_id === undefined) {
return false;
}
const $template = $(`#${CSS.escape(template_id)}`);
instance.setContent(parse_html($template.html())); instance.setContent(parse_html($template.html()));
} }
return undefined;
}, },
onHidden(instance) { onHidden(instance) {
instance.destroy(); instance.destroy();