Add a check for window blur and save any in-progress
messages as drafts. This will help prevent unnecessary
message loss for the user by creating drafts for them more
whenever they switch away from their Zulip tab.
Tested on my local Ubuntu development with a demo
organization and some of the premade profiles.
Fixes#35262.
Calling settings_data.user_can_access_all_other_users on every call to
this function could be expensive when using this function in loops
over every user in the organization.
After the previous commit, those calls are still somewhat expensive
for guest users.
It doesn't make sense that there would be no compose pill user ids
if there were compose pill emails, and there needs to be permission
to send a direct message or the message won't successfully send.
This was working before because `user_ids_string` ended up empty
in `validate_private_message`, which incorrectly returned true
for `check_dm_permissions_and_get_error_string`.
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 also attempts to fix a bug, present in main, where a
draft restored directly to the compose box loses its original topic
upon switching to other topic narrows.
Co-authored-by: Prakhar Pratyush <prakhar@zulip.com>
Added `enable_guest_user_dm_warning` setting to decide whether
clients should show a warning when a user is composing to a guest
user in the organization.
Fixes#30078.
Co-authored-by: adnan-td <generaladnan139@gmail.com>
For now compose_helpers only includes FakeComposeBox.
I don't love either of the names, but some of the alternatives
that I thought of have their own tradeoffs.
The compose_helpers module will soon have other
helper classes or functions in it, possibly including
the mock_banners helper from lib/compose_banner.
I don't want to step on mock_banners yet, because
I have two possible plans for improving that code,
and I haven't decided what's best yet, so for now
I don't want to step on it or move it, so I am
just leaving that alone for now.
Gotta start somewhere.
This is a bit of an emergency fix to fix the build, but
it is probably close to what we want.
Any test that cares about the height of the compose box
can probably override this behavior. Likewise for any
css calls.
The old function name sounded like you were entering
preview mode when, in fact, hitting the enter key
in some cases **exits** you from preview mode.
This was particularly confusing to read in the tests.
Adds a message length limit indicator similar to the one in the compose box.
The tooltip message for the disabled save button now appears dynamically
based on whether the message exceeds the length limit or the editing time
has expired.
Fixes#25271.
Refactors `check_overflow_text` and `validate_message_length` functions.
This commit ensures that there won't be any change in the existing UI
of the compose box with the refactoring of the above functions.