Commit Graph

23 Commits

Author SHA1 Message Date
Sahil Batra cd94837d6b drafts: Handle drafts with inaccessible users.
Inaccessible users are now shown as "Unknown user" in drafts UI.
2023-12-07 19:34:07 -08:00
Sahil Batra d67717c0d7 scheduled_messages: Handle scheduled messages to inaccessible users.
Inaccessible users are shown as "Unknown user" in the scheduled
messages list.
2023-12-07 19:34:07 -08:00
Sahil Batra 99f4f914e2 users: Handle UI for bots when bot owner is inaccessible. 2023-12-07 19:34:07 -08:00
Sahil Batra 30910a3403 settings_emoji: Handle unknown users as emoji authors.
Inaccessible emoji authors are shown as "Unknown user" in
emoji list.
2023-12-07 19:34:07 -08:00
Anders Kaseorg 9c7453c11e people: Downgrade get_user_time error to warning.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-30 12:36:06 -08:00
Anders Kaseorg 8a875b119f people: Remove final use of date-fns-tz.
date-fns-tz does not handle daylight saving time correctly, and can be
replaced with modern browser APIs.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-19 15:21:34 -08:00
Sayam Samal 24d74f68ee compose: Show pronouns in compose typeaheads.
This commit adds the pronouns custom profile field to the typeaheads in
the composebox along with the necessary node tests.

Details of the implementation:
- Added logic to display pronouns in ( ) next to the user's name when
  the user has a non-empty pronoun-type custom profile field.
- If multiple pronoun fields exist in the organization, the
  implementation selects the one earlier in the list of custom profile
  fields.
- No pronouns are displayed if the selected pronoun field is empty.

Fixes #26924.
2023-10-20 12:30:21 -07:00
Sahil Batra 59d025c570 people: Add "(guest)" for muted users as well.
This commit adds code to show "(guest)" for muted users
as well if the muted user is guest and the realm setting
is enabled.
2023-10-12 12:06:10 -07:00
Sahil Batra 127378f0ec users: Add "(guest)" to user name at various places.
This commit adds code to get_display_full_name function
to add "(guest)" indicator to guest user names if
enable_guest_user_indicator setting is enabled in the
organization.

The get_display_full_name function is used in many parts
of the code and thus this commit adds the indicator in
following places -
- Message recipient row for DMs including the messages
shown in scheduled messages overlay.
- DMs list in left sidebar and its tooltips.
- DMs info recent conversations view.
- "other senders" tooltip in recent conversations view.
- Compose button text.
- User names shown on reaction element and its tooltip.
- Desktop notifications and the browser title.
- Results for a poll.
2023-10-12 12:06:10 -07: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
Tim Abbott 1a89d49aba people: Add direct coverage of unknown user case. 2023-09-25 06:29:47 -07:00
Tim Abbott 454b3542ec tests: Rename unknown_user in people tests. 2023-09-25 06:29:47 -07:00
evykassirer 0b1a41ad09 recent: Rename sender_info_for_recent_topics_row. 2023-09-08 07:36:33 -07:00
Lalit 59e78f96ba
ts: Migrate people.js to TypeScript.
We use `get_by_user_id` instead of directly accessing the global dict, because
when accessing person objects directly from one of the global dicts we
need callers to check for undefined values, this can be fixed by using
`get_by_user_id` method to get person objects because that functions
makes sure to assert that we indeed have a valid user id, so it will
never return undefined values.

Co-authored-by: Zixuan James Li <p359101898@gmail.com>
2023-07-11 22:22:30 -07:00
nicmar-8 f688dc4c85 people: Add new function `get_realm_active_human_users`.
There was no function to retrieve users while excluding bots,
this was needed to allow for typeahead user fields that require
to exclude bots from the autocomplete suggestions.

Fixes part of #25092.
2023-07-06 16:32:08 -07:00
nicmar-8 7be72e65e5 people: Rename get_active_human_ids function for clarity.
Rename `get_active_human_ids` to `get_realm_active_human_user_ids`
to better fit naming conventions and to be more clear about the
detail that it only includes active users.

Fixes part of #25092.
2023-07-06 16:32:08 -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
Lalit 7ac891a6b9 people: Add `version` parameter for medium sized avatar urls.
We need to append the `version` parameter when constructing the urls for
medium-sized images so that the browser updates the image in real time when
the user uploads a new avatar.

Fixes #25558.
2023-05-19 13:52:00 -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
Lauryn Menard 0f7341dd48 narrow: Add frontend support for `dm:` narrow and `/dm/...` URL.
Adds support in the web app for `dm` operator. This will deprecate
the `pm-with` operator, but existing links/URLs are still supported
for backwards-compatilibity.

This commit updates the web app default behaviors to default to
the new narrow/URLs `dm/...` and `/#narrow/dm/...` when navigating
and searching in the app.

There is some general clean up of references to private messages
or PMs to be either direct messages or DMs in these changes.

The general API changelog and documentation updates will be done
in a final commit in the series of commits that adds support for
the various new direct message narrows.
2023-04-25 09:07:08 -07:00
Alex Vandiver 2d5c678614 blueslip: Only show in dev mode, or report to Sentry.
This removes the production reporting to `/json/report/error` upon
`blueslip.error`, and replaces it with reporting to Sentry, if
enabled.  Sentry provides better reporting and grouping for exceptions
than the email- and `#errors`-reporting provided by the
`/json/report/error` endpoint.

The development behaviour of rendering `blueslip.error` messages and
stacktraces immediately, and stopping execution, is preserved.

To better chain exception information, the whole previous exception is
passed to `blueslip.error`, not just the stack, and the second
parameter is formalized to be an object to map to Sentry's "context"
concept.
2023-04-13 14:59:58 -07:00
Zixuan James Li cd97c497bc people: Do not return undefined for is_cross_realm_email.
It would be semantically more straightfoward to return false when the
check does not succeed.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-03-16 10:47:12 -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