Applied patches for search and direct_message + fixed sort order of
search

Applied both patches from Mario Bensi for direct_messages and search.
Fixed the search order as well.

BUG: 264091