Page MenuHomePhabricator

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

Authored by rohan on Mar 28 2023, 8:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 7:39 PM
Unknown Object (File)
Fri, Apr 12, 2:33 AM
Unknown Object (File)
Thu, Apr 11, 8:31 AM
Unknown Object (File)
Thu, Apr 4, 5:33 AM
Unknown Object (File)
Fri, Mar 29, 12:29 AM
Unknown Object (File)
Sat, Mar 23, 4:43 AM
Unknown Object (File)
Mar 16 2024, 3:15 AM
Unknown Object (File)
Mar 9 2024, 10:59 AM
Subscribers

Details

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

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rohan edited the test plan for this revision. (Show Details)
rohan edited the test plan for this revision. (Show Details)
rohan edited the test plan for this revision. (Show Details)
rohan requested review of this revision.Mar 28 2023, 9:13 AM

Move logic from message-creator to thread-updaters

ashoat added inline comments.
keyserver/src/updaters/thread-updaters.js
894 ↗(On Diff #24295)

Nit

899 ↗(On Diff #24295)

Nit

This revision is now accepted and ready to land.Mar 28 2023, 11:21 AM