Both of these handlers immediately hide the banner, so the difference
between .on() and .one() doesn’t matter.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
While uploading a file, if you close the compose box, and reopen
it, compose send button remains disabled due to upload in progress
being true.
To fix it, we update upload status for compose when upload is
cancelled.
Compose send tooltip was not correctly displayed when the compose
box was in an invalid state.
We significanlty improve the logic for displaying the tooltip here
to provide a more robust experience to the user.
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.