HomePhabricator
Diffusion Comm f2a617f0a07e

[keyserver] Introduce a new thread permission for pinning / unpinning messages

Tags
None
Referenced Files
F435800: memberships.png
Apr 11 2023, 9:00 AM
File Not Attached
F435799: roles.png
Apr 11 2023, 9:00 AM
File Not Attached
F435798: migration.png
Apr 11 2023, 9:00 AM
File Not Attached
Subscribers
None

Description

[keyserver] Introduce a new thread permission for pinning / unpinning messages

Summary:
We need to introduces new thread permission that limits who is able to manage the pins for a thread. At the moment, this is only granted to Admins, so there's a couple of things that need to be done here:

  1. Update the baseAdminPriviledges so new chats with admins will have the correct, updated permissions
  2. Run a migration to cover existing threads

We call updateRolesAndPermissionsForAllThreads() which should handle updating the permissions for each of the threads given the new roles.

The migration was discussed in the Linear task.

Depends on D7199

Test Plan:

  1. Confirm that the migration is successful

migration.png (358×1 px, 297 KB)

  1. Confirm that the roles table is updated for Admins (expected result is that the query only finds Admins to have the new permissions)

roles.png (254×2 px, 131 KB)

  1. Confirm that the memberships table for each of the threads is updated (expected result is that the query finds the permissions to be NOT NULL in each thread for user 256, the admin user locally)

memberships.png (306×2 px, 162 KB)

Reviewers: atul, ginsu, tomek, ashoat

Reviewed By: ashoat

Subscribers: ashoat

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