Page MenuHomePhabricator

[native] Use CreateRolesScreenHeaderRightButton to save a new role
ClosedPublic

Authored by rohan on Jul 3 2023, 8:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 26, 7:40 AM
Unknown Object (File)
Tue, Nov 26, 7:23 AM
Unknown Object (File)
Tue, Nov 26, 5:52 AM
Unknown Object (File)
Sat, Nov 23, 7:15 AM
Unknown Object (File)
Thu, Nov 7, 9:55 PM
Unknown Object (File)
Thu, Nov 7, 9:55 PM
Unknown Object (File)
Thu, Nov 7, 9:55 PM
Unknown Object (File)
Thu, Nov 7, 9:55 PM
Subscribers

Details

Summary

This is the client-side implementation of allowing a user to save their custom role for their community. Since CreateRolesHeaderRightButton needs access to both the roleName and the rolePermissions, it made sense to include those in the navigation route params, and I can pull them directly from there. That's why the React.useEffect hook updates the params.

This is also useful because once I work on the edit_role flow, I can default the roleName and rolePermissions to the existing name/permissions to 'pre-fill' the info for the client.

Depends on D8420

ENG-4174.

Test Plan

Create a new role and click on the 'Create' button. Check my local DB and verify that the role has been created with the selected permissions (for the demo video, you should be able to see all of the guaranteed permissions from the previous diff, and just the manage_pins and descendant_manage_pins from the configurable permissions).

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

rohan edited the summary of this revision. (Show Details)
rohan requested review of this revision.Jul 3 2023, 9:14 AM

Minor nits

native/roles/community-roles-screen.react.js
56 ↗(On Diff #28429)

We typically don't capitalize the second word like this

native/roles/create-roles-screen.react.js
98–105 ↗(On Diff #28429)

I think this shorthand should work with Flow

132 ↗(On Diff #28429)

Potentially could use the same shorthand here

few minor nits inline, but looks good!

native/roles/create-roles-header-right-button.react.js
24 ↗(On Diff #28488)

very small nit: onPressCreate would be a better name for this callback

50 ↗(On Diff #28488)

very small nit: I think createButton would be a better name for this style

This revision is now accepted and ready to land.Jul 11 2023, 4:10 PM

Use a set intead of an array