HomePhabricator
Diffusion Comm 6ce90634cf4a

[keyserver] Update pinnedCount when a message is pinned and unpinned

Description

[keyserver] Update pinnedCount when a message is pinned and unpinned

Summary:
Now that pinned_count is stored in the database, we want to trigger an update when a message is pinned or unpinned to reflect the most up to date value of how many pins are in a thread.

Linear: https://linear.app/comm/issue/ENG-3403/update-pinnedcount-when-a-message-is-pinned-and-unpinned

Depends on D7211

Test Plan:

  1. Trigger a ‘toggle pin’ when the media gallery is opened (for now)
  2. Display the threadInfo.pinnedCount somewhere visible, for the test I displayed it right by ChatThreadListItem
  3. Open the media gallery (to pin a message) on an admin user, and confirm the other account part of the thread receives the updated pin count
  4. Confirm the permissions by trying to doing the same on the non-admin account and having an invalid_credentials server error in my logs
  5. Validate the same, but for unpinning, where the pinned_count should decrease each time

Message Pin

Message Unpin

Reviewers: atul, ginsu, tomek, ashoat

Reviewed By: ashoat

Subscribers: ashoat

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