Page MenuHomePhabricator

[lib] Make sure community admins can always react and edit messages
ClosedPublic

Authored by ashoat on Aug 13 2024, 7:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 19, 2:33 PM
Unknown Object (File)
Sat, Oct 19, 2:33 PM
Unknown Object (File)
Sat, Oct 19, 2:32 PM
Unknown Object (File)
Sat, Oct 19, 2:32 PM
Unknown Object (File)
Mon, Oct 14, 4:58 AM
Unknown Object (File)
Mon, Oct 14, 4:33 AM
Unknown Object (File)
Mon, Oct 14, 2:20 AM
Unknown Object (File)
Mon, Oct 14, 1:25 AM
Subscribers

Details

Summary

In ENG-9026, @inka uncovered an issue where the admin of a community doesn't have the ability to react.

This is occurring because of my changes in D13017. In that diff, I changed where certain permissions were coming from, including REACT_TO_MESSAGE and EDIT_MESSAGE.

Previously these permissions would come from getRolePermissionBlobs, meaning that the permissions would come from each individual chat's role permissions. This didn't work because it meant that the user-surfaced role permissions system was not respected for channels under a community root; it only affected the root.

After my changes, the permissions came from userSurfacedPermissionOptions. However, the problem was that we only use these user-surfaced permissions for members, not for admins.

As a result of removing the permissions from getRolePermissionBlobs for both members and admins, without replacing them for admins, not REACT_TO_MESSAGE and EDIT_MESSAGE became missing for admins.

This diff addresses it by making sure admins can always react and edit messages in all chats within a community.

Test Plan
  1. I went through each individual permission removed from getRolePermissionBlobs in D13017, and making sure the admins had it. In most cases this was already covered, as an older iteration of the permissions system required admins to have all permissions listed explicitly. However, when REACT_TO_MESSAGE and EDIT_MESSAGE were introduced, we were able to give them to both admins and members by adding them to getRolePermissionBlobs; as such, these had never been added for admins to getRolePermissionBlobsForCommunityRoot.
  2. In combination with later diffs (including a migration to update permissions), I tested to make sure that ENG-9026 is resolved, and my keyserver admin can react to messages in a non-GENESIS community. (I also tested GENESIS, but that required additional fixes which are included in later diffs.)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable