HomePhabricator
Diffusion Comm 277f0ba1557f

[lib] Update existing checks on isDefault in thread-utils.js

Description

[lib] Update existing checks on isDefault in thread-utils.js

Summary:
We now want to make sure that we get rid of checks on role.isDefault and replace them with checks on role.specialRole:

  • For default roles, this is `role.specialRole === ${specialRoles.DEFAULT_ROLE}
  • For admin roles, this is `role.specialRole === ${specialRoles.ADMIN_ROLE}

Introducing a new utility function roleIsDefaultRole and updating roleIsAdminRole in this diff so we no longer have such hacky checks (and so I can update other callsites of role.isDefault with roleIsDefaultRole)

Part of ENG-5993

Depends on D10115

Test Plan:

  • Confirmed that callsites of roleIsAdminRole had no difference in behavior (i.e. the old and new roleIsAdminRole returned the same value)
  • Confirmed that roleIsDefaultRole was correct by doing a logical read through the code and manually calling the function myself to test the return value on roles

Reviewers: ginsu, tomek, rohan

Reviewed By: tomek

Subscribers: ashoat

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

Details

Provenance
atulAuthored on Feb 22 2024, 1:33 PM
Reviewer
tomek
Differential Revision
D10116: [lib] Update existing checks on isDefault in thread-utils.js
Parents
rCOMM204ce2737677: [keyserver] improve error message on identity connection failure
Branches
Unknown
Tags
Unknown