HomePhabricator
Diffusion Comm e761a585c9dc

[keyserver] Always fetch the latest message for threads

Description

[keyserver] Always fetch the latest message for threads

Summary:
ENG-891

We can efficiently fetch the latest message for each thread using the memberships.last_message column. Thanks to this we should get correct message preview and thread ordering in thread list.

NOTE: the no messages issue still can happen in the genesis chat because of ENG-4101

Test Plan:

  • tested on mobile and web and checked if the messages previews are correctly displayed
  • checked that the only code paths that are changed by this diff is website-responders and login/register. Other methods that fetch messages are not affected
  • the query was tested on prod db and the time was similar, so performance shouldn't be an issue

Reviewers: kamil, inka, tomek

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D8492