Page MenuHomePhabricator

[native] Introduce `useStaffCanSee()`
ClosedPublic

Authored by atul on Oct 28 2022, 12:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 9:13 AM
Unknown Object (File)
Thu, Mar 28, 4:51 AM
Unknown Object (File)
Mar 27 2024, 1:19 PM
Unknown Object (File)
Mar 27 2024, 1:19 PM
Unknown Object (File)
Mar 27 2024, 1:19 PM
Unknown Object (File)
Mar 25 2024, 2:19 PM
Unknown Object (File)
Mar 25 2024, 2:19 PM
Unknown Object (File)
Mar 25 2024, 2:19 PM
Subscribers

Details

Summary

Context: https://linear.app/comm/issue/ENG-2134/have-a-flag-that-indicates-whether-the-build-is-a-staff-release

Utility that tells us whether we're running a debug build (__DEV__) and/or are "staff" (isStaff(state.currentUserInfo.id)) and/or are on a staff release (isStaffRelease).

In subsequent diff will use this function where isStaff || __DEV__ checks were used in the past.

Test Plan

Logged values and they were as expected:

42f5c5.png (1×1 px, 433 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/utils/staff-utils.js
7 ↗(On Diff #17967)

Will set this value to true when I make staff releases

atul requested review of this revision.Oct 28 2022, 12:30 PM

Might be good to update places that check __DEV__ || isStaff in this diff

This revision is now accepted and ready to land.Oct 28 2022, 1:33 PM

Might be good to update places that check __DEV__ || isStaff in this diff

Will update this diff

Three places I found that need to be changed (by searching __DEV__ and isStaff in native):

  • input-state-container
  • sqlite-context-provider
  • profile-screen

use useStaffCanSee throughout native

think i got them all, i'll do another scan through

This revision is now accepted and ready to land.Oct 31 2022, 1:04 PM
atul requested review of this revision.Oct 31 2022, 1:19 PM
atul added inline comments.
native/profile/profile-screen.react.js
56–70 ↗(On Diff #17998)

Sorry, snuck in repositioning of props here so they're above the component they correspond to

Ensure truthiness of state.currentUserInfo && state.currentUserInfo.id before isStaff(...) check

This revision is now accepted and ready to land.Nov 1 2022, 5:18 AM
This revision was landed with ongoing or failed builds.Nov 1 2022, 10:33 AM
This revision was automatically updated to reflect the committed changes.