Commit Graph

12 Commits

Author SHA1 Message Date
N-Shar-ma 8002f0db8f compose: Fix bug where sometimes message draft remained post sending it.
Now whenever we initiate sending a message, we save / update its draft,
which is deleted on a successful send. Earlier, we did this only for
locally echoed messages. Hence a non locally echoed message's draft
would remain, if created in the timeframe between initiating send and
receiving the same message from the server, which can be significant
for slow connections.
2024-02-20 11:59:46 -08:00
Anders Kaseorg e96ede0ef6 page_params: Split out state data for current user.
For spectators, the chunk of page_params that originates from
do_events_register isn’t assigned until ui_init.js.  That means the
TypeScript type of page_params is mostly a lie during module load
time: reading a parameter too early silently results in undefined
rather than the declared type, with unpredictable results later on.

We want to make such an early read into an immediate runtime error,
for both users and spectators consistently, and pave the way for
runtime validation of the page_params type.  As a first step, split
out the subset of fields that pertain to the current user.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
evykassirer 0571145029 markdown: Remove wrapper around get_topic_links.
Since it's only used in one place, and all callers
of it user the same value for the linkifier.

https://github.com/zulip/zulip/pull/28652#discussion_r1470516258
2024-02-01 12:12:06 -08:00
evykassirer fb47efc981 markdown: Don't mutate the message in apply_markdown/render.
Needed for typescript, because we want to preserve
types, so instead of mutating a message object,
we can instead calculate return these values
for a message object before it's created in full.

This commit also renames apply_markdown
to render, see this comment
https://github.com/zulip/zulip/pull/28652#discussion_r1470514780
2024-02-01 12:12:06 -08:00
Evy Kassirer 6e902defba
node tests: Use noop helper function pattern in test files.
Some files already were using `noop` in place of `() => {}`.
It's both clearer what it means and is easier to type.
This updates all test files to fully use `noop`, and
adds a shared import from the test lib file.
2023-12-14 14:51:33 -08:00
Anders Kaseorg 6ef08873d8 notifications: Split out compose_notifications module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-06 16:22:40 -07:00
evykassirer 846b470b99 messages: Use stream_id instead of stream name.
This should cause no functional changes.

This is part of a multi-step effort to move away
from using stream names to reference streams, now
that it's impossible for a user to write a message
with an invalid stream name (since switching to
the dropdown).
2023-08-21 15:10:17 -07:00
Lalit 9447381d03 echo: Cut dependency on `message_events.js`. 2023-07-11 22:33:59 -07:00
Lauryn Menard 73e5812831 node-tests: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/tests`
directory to instead use "direct messages".
2023-06-26 11:07:28 -07:00
Alex Vandiver 3cc2adcd3b sentry: Switch to using Sentry spans for message send timings. 2023-05-09 13:16:28 -07:00
Lalit 7e52509ee7 ui: Move update_message_lists related functions to other related modules.
This commit moves mainly two functions from `ui.js` to `message_live_update`,
`update_message_in_all_views` and `update_starred_view`. This is done in favor of
eliminating `ui.js` and also these functions are more closely related to
`message_live_update` module than to `ui` module.

We also move `show_message_failed` and `show_failed_message_success` to `echo.js`
for cleaner seperation of responsibilities.
2023-04-26 12:59:08 -07:00
Anders Kaseorg cea1119423 node_tests: Move to web/tests.
This lets us simplify the long-ish ‘../../static/js’ paths, and will
remove the need for the ‘zrequire’ wrapper.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-23 16:04:17 -08:00