Commit Graph

15 Commits

Author SHA1 Message Date
Anders Kaseorg e84bb9ff2c tests: Unmock state_data.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg 95153b3f0c tests: Use override for realm.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg 8e49ca163b tests: Unmock user_settings.
We previously auto-mocked this out of expediency, but that made it
impossible to test anything that uses the Zod schemata in the same
module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg 4d74ecccf3 tests: Use override for user_settings.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg ba8b9a445b eslint: Fix unicorn/prefer-node-protocol.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-08 16:54:15 -07:00
Sahil Batra a70eb21ea1 settings: Use page_params.is_spectator field for spectator checks.
Instead of current_user.user_id we use page_params.is_spectator
field to check the spectator cases as it makes it more clear
to the reader about what is the condition checking.
2024-06-14 17:11:23 -07:00
Mateusz Mandera 3ded4c2a7d presence: Frontend implementation of the last_update_id API.
Note: This involves adding presence info of unknown users to the
presence data.
With some small tweaks, we can just add the info to the presence data
structures, just making sure the buddy list correctly skips those
entries and that we redraw the user in the case where the user creation
event arrives after the presence polling loop.
2024-06-07 13:57:40 -07:00
Anders Kaseorg b9e62c7af8 page_params: Split out state data for realm.
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 second step, split
out the subset of fields that pertain to the entire realm.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg f88e3b9735 presence: Remove paranoid handling of falsy timestamps.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-23 15:36:05 -08:00
Sahil Batra 7da68259a6 presence: Do not raise blueslip error for presence data of unknown user.
We have already fixed the actual bugs that were resulting in client
receiving presence data for unknown user, so we can remove the
blueslip logging and just skip the unknown users.
2023-11-29 12:01:37 -08:00
Anders Kaseorg 63c9296d53 tests: Fix direct mutation of ES modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 18:00:38 -07:00
Lalit Singh 2893685890 people: Revert to using `ignore_missing` parameter.
We revert to use `ignore_missing` parameter for `maybe_get_user_by_id`
function to avoid sending unnecessary `blueslip.error()` calls to
sentry.
2023-08-02 17:25:14 -07:00
Lalit 1c8bf4f050 people: Make `get_by_user_id` type-safe.
We should make `get_by_user_id` type-safe in the sense that it's caller
should not expect undefined values and hence it's caller should not
need to validate the user ids.

To do this I extracted a method `maybe_get_user_by_id` which is
type-unsafe version of this function which will allow undefined values
and will behave exactly the same as the previous version. So the callers
which expects the undefined values from this function should use this
new function `maybe_get_user_by_id`.

Probably about half of these callers are implicitly iterating through
all users in the people.js data set and thus by construction should
never fail, but it's simpler to just convert all existing callers than
do that audit.
2023-07-02 16:57:16 -07:00
Alex Vandiver 64b277d845 blueslip: Reduce cardinality of blueslip.error() calls.
Particularly when grouping in Sentry, pushing the ids and such into
the additional data section helps group like errors together better.
2023-05-09 13:16:28 -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