HomePhabricator
Diffusion Comm f4f87f5e87e0

[lib] Remove usage of `memberHasAdminPowers` in `useThreadSearchIndex`

Description

[lib] Remove usage of memberHasAdminPowers in useThreadSearchIndex

Summary:
As part of https://linear.app/comm/issue/ENG-6933/update-memberhasadminpower-logic-to-rely-on-specialrole-field, we're going to update memberHasAdminPowers so it determines whether a member is an admin not based on derived permissions, but whether they have an admin role in the community thread.

This will require us to change the signature of memberHasAdminPowers to include additional info (eg ThreadInfo). Before making that change, I wanted to go through all of the usages of memberHasAdminPowers to see how things would need to change at the callsite.

With useThreadSearchIndex, it was more efficient to calculate a map inline of communityThreadID -> memberID -> RoleInfo once and query that multidimensional dictionary rather than call a modified memberHasAdminPowers with communityThreadInfo and threadInfo.


Depends on D11263

Test Plan:

  1. Able to log that the dictionary was constructed properly:
  1. Able to log that the computed isAdmin values were as expected:

Reviewers: ginsu, tomek, michal, kamil

Reviewed By: tomek

Subscribers: ashoat

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

Details

Provenance
atulAuthored on Mar 20 2024, 11:16 AM
Reviewer
tomek
Differential Revision
D11276: [lib] Remove usage of `memberHasAdminPowers` in `useThreadSearchIndex`
Parents
rCOMMcb303c6ea6b6: [lib] Omit `isDefault` field in `rawThreadInfoFromServerThreadInfo`
Branches
Unknown
Tags
Unknown