We should search for what the user asked us to search for.
CZO conversation:
https://chat.zulip.org/#narrow/stream/101-design/topic/search.20buddy.20list.20for.20self/near/1630454
This commit also stops the user from being at the top of
the search list, so that the search list is fully
alphabetical (though still sorted by online status).
We switch to not having the user at the top of the list
only when there's search text in the search bar, otherwise
there'd be a visual jump that would happen just by opening
the search bar. There's almost always visual change when
entering text into the search input field, so that seems
like the time to change the sorting.
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.
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.
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>