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)
Fri, Nov 8, 5:39 PM
Unknown Object (File)
Fri, Nov 8, 5:39 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:22 PM
Unknown Object (File)
Fri, Nov 8, 5:01 PM
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
No Lint Coverage
Unit
No Test Coverage

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