compose: Add tooltip support for invalid messages.

This commit adds tooltip support for various
invalid conditions mentioned in issue 32115.

A `show_banner` positional argument is added
in the `validate` method which has a default
value of true.

The reason behind introducing this is to
not trigger banners on hovering the disabled
send button, since the tooltip message is also
determined using the same validate method.

We want to only disable the button on hover,
which is why the update_send_button_status() method
is called only on "mouseenter" event, which is
added to the send button in compose_setup.js

To incorporate this change a new param is
introduced which determines whether to enable/disable
send_button by running update_send_button_status

Earlier, typing something in the textarea or
recipient box would also trigger
`update_send_button_status` which doesn't
work well since we've introduced a lot of
new booleans which determine whether send
button gets disabled causing send button to
get disabled while typing instead while hovering
Hence this change.
This commit is contained in:
apoorvapendse
2025-01-10 12:06:44 +05:30
committed by Tim Abbott
parent 8496a40564
commit 0b12c51771
5 changed files with 100 additions and 22 deletions

View File

@@ -275,6 +275,12 @@ export function initialize(): void {
target: ".disabled-message-send-controls",
// 350px at 14px/1em
maxWidth: "25em",
onTrigger(instance) {
instance.setContent(
compose_recipient.get_posting_policy_error_message() ||
compose_validate.get_disabled_send_tooltip(),
);
},
content: () =>
compose_recipient.get_posting_policy_error_message() ||
compose_validate.get_disabled_send_tooltip(),