Commit Graph

12 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 ba8b9a445b eslint: Fix unicorn/prefer-node-protocol.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-08 16:54:15 -07:00
Alex Vandiver b89d47a147 avatar: Stop adding &s=50 to Gravatar and Zulip avatar requests.
This parameter is unused for Zulip avatars, and results in a smaller
(pixel-wise) Gravatar than we use for Zulip "small" avatars.  Omitting
the `s=50` parameter results in a 80x80 image, which is closer to the
100x100 image that Zulip thumbnails avatars to.  Ironically, using the
default (larger) Gravatar dimensions also results in _smaller_
responses (in bytes) from Gravatar.
2024-08-13 08:57:08 -07:00
evykassirer 6e47d851ec input_pill: Remove display_value in favor of module-specific values.
This commit is part of a bigger project to remove custom logic in
the input_pill module. This commit move us away from a world where
we have a `display_value` that's used as identifying information
for a pill as well as for what we display to the user. Now individual
widgets can configure how they come up with a display value based
on the data of that type of pill.

Note: The change in the stream pill test for setting subscribers
for denmark is fixing an issue that wasn't discoverable before.
There always should have been three subscribers.
2024-08-01 17:31:59 -07:00
Anders Kaseorg aaf90a1da0 typeahead: Nest User inside UserPillData, UserOrMention.
Commit 33484e7ac3 (#29200) added a cache
for remove_diacritics, but this caching was rendered ineffective by
commit 45e9c046d8 (#29650) because it
relied on mutating a direct reference to the User object.  Fix the
cache by rearranging the types to preserve that direct reference.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-06 15:24:54 -07:00
evykassirer 45e9c046d8 pill_typeahead: Differentiate between pills with type attribute.
The pill typeahead can have pills of three different types:
user, stream, and user_group. To be able to convert this
module to typescript, we need to add a `type` attribute
to differentiate between them.

This commit also adds a `user_or_mention` type to some
items in the composebox typeahead, because the composebox
typeahead shares some functions with the pill typeahead
and we need to be able to differentiate between the
pill types being passed there.
2024-04-17 10:45:14 -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
Sahil Batra 9197a2c3e2 user_pill: Add support to not allow adding inaccessible users manually.
We previously allowed adding pills for inaccessible user by typing
the email manually. This commit updates it to handle inaccessible
users like we handle invalid emails.
2024-01-03 11:04:35 -08:00
Sahil Batra 3d181a8ee1 settings: Remove "User groups" panel from settings overlay.
The "User groups" panel is now removed from settings overlay
and we instead use new "#groups" UI.

This commit also makes some changes to tests to ensure coverage
for pill_typeahead.js which was previously done by
settings_user_group_legacy.test.js. We have still not got
complete coverage on user_pill.ts as we have removed
settings_user_group_legacy.test.js, but we just add the file
to EXEMPT_FILS list for now and will handle it in future.

Fixes #28012.
2023-12-07 06:35:38 -08:00
Sahil Batra 49a047c27f users: Add "(guest)" to names for guest users.
This commit adds code to add "(guest)" to user names of guest
users in the following places -
- right sidebar
- user pills, including the pills in search suggestion typehaead
- typeaheads for user
- sender names in message feed
- user profile popover and modals.
- user name in not subscribed warning banner.

Note that the indicator is shown only if enable_guest_user_indicator
setting is set to true.

As a result of this change, we now translate "deactivated" text
shown in user pills for deactivated users.

Fixes part of #26700.
2023-10-12 12:06:10 -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