Commit Graph

25 Commits

Author SHA1 Message Date
Tim Abbott
cdeb7f137f compose_state: Strip leading newlines to match server.
This fixes a bug where if you send a message with leading newlines,
you can't edit it until you've reloaded the browser.
2025-07-11 13:06:32 -07:00
whilstsomebody
9ef3a19451 compose: Prevent displaying banner when channel picker is opened.
Prevent displaying the topic resolved banner when the channel
picker (compose_select_recipient_dropdown_widget) is opened in
the case of forwarding messages. This is done to prevent the
overlap of the channel picker and the banner, as it hides some
part of the banner text.

Fixes: #33449
2025-06-30 14:02:58 -07:00
Vector73
8fb1eeeb09 mandatory_topics: Refactor mandatory_topics check into a function. 2025-06-17 17:05:58 -07:00
Evy Kassirer
efda73536f compose: Prefer using recipient_ids over recipient_emails. 2025-05-16 10:51:29 -07:00
Evy Kassirer
38bf407c9a compose_actions: Migrate start() to use pm recipient ids. 2025-05-16 10:51:29 -07:00
Evy Kassirer
464b7f4540 compose_state: Rename private_message_recipient to clarify it stores emails.
This will add clarity as we move towards using ids more and emails
less.
2025-05-16 10:51:29 -07:00
Harsh
f2b33fc3ee compose: Add banner when topic is moved and recipient is updated.
This commit adds the INFO compose banner for new channel/topic when the
recipient is updated when topic is moved.

fixes: #33445.
2025-04-13 20:29:58 -07:00
ubaidrmn
1a97fecdb8 compose: Fix preview not being updated when compose textarea is updated.
In preview mode, background updates to the compose box don’t refresh
the preview. For example, canceling an ongoing file upload after
activating preview mode still displays "uploading."

This commit extracts the preview rendering logic from the
show_preview_area function into a new function, `render_preview_area`,
and calls it on the compose textarea’s change event to ensure the
preview updates whenever the textarea is modified.

However, this introduces a race condition where the latest request is
not always reflected in the preview. To resolve this, we introduce a
state variable, `preview_render_count`, which is used to ensure only
the latest preview update is applied.

Fixes #33589.
2025-03-03 17:38:27 -08:00
Karl Stolley
a3a43c2f8b compose: Handle fading with general chat.
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>
2025-02-26 13:59:03 -08:00
Prakhar Pratyush
c777fede07 compose_state: Remove empty_topic_placeholder function.
This commit removes `empty_topic_placeholder` function as
it is no longer used.
2025-02-20 10:09:41 -08:00
Vector73
cb6f0fd63c realm: Add setting to notify user on DMing guest.
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>
2025-02-06 12:15:41 -08:00
Karl Stolley
b4fe3fa37b compose: Allow left arrow to scroll buttons. 2025-01-21 08:57:59 -08:00
Emil Grehn
f9b95bd4f3 message_quoting: Add a "Forward message" option below "Quote message".
Forward message starts a new message with the quoted context
(message or selection).
The compose box opens with then channel picker open and no topic.

Also added documentation about this feature in the help center.

Fixes part 2 of #31953
2024-12-04 22:25:14 -08:00
Anders Kaseorg
ec3177c834 web: Add explicit extensions to imports.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-13 09:18:56 -08:00
Anders Kaseorg
52e59a9605 web: Add setters for rewired variables.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-08 12:38:14 -08:00
evykassirer
346dc7d79d compose: Auto-close unchanged auto-opened drafts on narrow change.
Fixes #30104.
2024-06-07 10:38:20 -07:00
Anders Kaseorg
c8981be08f compose_state: Fix last_focused_compose_type_input type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-15 10:53:09 -07:00
Tim Abbott
7beea02660 compose_state: Reuse has_savable_message_content. 2024-04-20 13:29:22 -07:00
evykassirer
3ef4e80dff compose: Add button to save draft and start a new message. 2024-04-20 13:27:24 -07:00
Anders Kaseorg
2c13d0e43d eslint: Fix @typescript-eslint/no-unnecessary-type-assertion.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Tim Abbott
d98580ab14 compose_state: Remove incorrect recipient_has_topics helper.
This function was introduced in
99d1c5a1f3 and always has the opposite
value from what its name suggests. It worked OK because the caller
also expected it to have an incorrect value.

It's cleaner in this context to just use the `stream_id` helper, so
just delete the bad code and use that.

Fix the docstring comment having been incorrectly pushed down while
we're addressing this.
2024-03-11 16:31:58 -07:00
N-Shar-ma
2952f0f44f refactor: Initialise state variables to undefined instead of false.
For compose state variables `last_focused_compose_type_input` and
`message_type` that are assigned non-boolean values on user interaction,
`undefined` is the semantically better choice than `false` for
initialisation, to avoid incorrect boolean implications.
2024-01-14 18:11:26 -08:00
Anders Kaseorg
3d55e7ef10 eslint: Fix @typescript-eslint/prefer-nullish-coalescing.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-23 15:36:05 -08:00
N-Shar-ma
4610c1a257 compose: Keep track of the last compose type textarea focused on.
This is a prep commit for the next commit, which will quote a message
into the last focused compose type textarea, which we track in a new
`compose_state` variable in this commit.
2023-11-21 11:20:13 -08:00
Anders Kaseorg
b3fa7b15fc compose_state: Convert module to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-02 14:06:04 -07:00