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)
Thu, Sep 26, 9:24 AM
Unknown Object (File)
Fri, Sep 20, 7:42 PM
Unknown Object (File)
Mon, Sep 16, 12:06 PM
Unknown Object (File)
Mon, Sep 16, 4:44 AM
Unknown Object (File)
Sun, Sep 15, 5:16 PM
Unknown Object (File)
Sun, Sep 15, 12:04 PM
Unknown Object (File)
Wed, Sep 4, 8:08 PM
Unknown Object (File)
Aug 28 2024, 12:36 AM
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