HomePhabricator
Diffusion Comm f1ed5990ecef

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

Description

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

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.)

Reviewers: tomek, inka

Reviewed By: tomek

Subscribers: inka

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

Details

Provenance
ashoatAuthored on Aug 13 2024, 7:08 AM
Reviewer
tomek
Differential Revision
D13061: [lib] Make sure community admins can always react and edit messages
Parents
rCOMMb0ad2ef37bb1: [native] Move onTipContainerLayout
Branches
Unknown
Tags
Unknown