-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#16935] Workspace creation with Policy Draft info #29256
[#16935] Workspace creation with Policy Draft info #29256
Conversation
@@ -194,7 +192,7 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, u | |||
accessibilityLabel={translate('workspace.new.newWorkspace')} | |||
success | |||
text={translate('workspace.new.newWorkspace')} | |||
onPress={() => App.createWorkspaceAndNavigateToIt('', false, '', false, !isSmallScreenWidth)} | |||
onPress={() => App.createWorkspaceWithPolicyDraftAndNavigateToIt()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't just do
onPress={App.createWorkspaceWithPolicyDraftAndNavigateToIt}
because the onPress
send a button event, and that object is passed and it breaks the calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left comments.
src/libs/actions/App.js
Outdated
@@ -336,6 +336,40 @@ function createWorkspaceAndNavigateToIt(policyOwnerEmail = '', makeMeAdmin = fal | |||
.then(endSignOnTransition); | |||
} | |||
|
|||
/** | |||
* Create a new Draft workspace and navigate to it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Create a new Draft workspace and navigate to it | |
* Create a new draft workspace and navigate to it |
return; | ||
} | ||
|
||
App.savePolicyDraftByNewWorkspace(props.policyDraft.id, props.policyDraft.name, '', false, '', !isSmallScreenWidth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
App.savePolicyDraftByNewWorkspace(props.policyDraft.id, props.policyDraft.name, '', false, '', !isSmallScreenWidth); | |
App.savePolicyDraftByNewWorkspace(props.policyDraft.id, props.policyDraft.name, '', false); |
src/libs/actions/Policy.js
Outdated
{ | ||
onyxMethod: Onyx.METHOD.SET, | ||
key: `${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${policyID}`, | ||
value: null, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.SET, | ||
key: `${ONYXKEYS.COLLECTION.POLICY_MEMBERS}${policyID}`, | ||
value: null, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think updates are done in order. It seems safer to clear the draft policy at last.
This is causing a crash if we try to access the admin/announce room offline Screen.Recording.2023-10-13.at.3.09.35.AM.mov |
@s77rt can you send me the steps, I'm not able to reproduce it. I just pushed, there was a typo, I wasn't deleting the |
I can't reproduce the bug now. Seems working fine. Probably related to the typo |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemweb-chrome.movMobile Web - Safarimweb-safari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
@gedu Great work! Day & night UX difference. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you guys!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/marcochavezf in version: 1.3.85-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.85-4 🚀
|
🚀 Deployed to staging by https://github.com/marcochavezf in version: 1.3.86-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.86-5 🚀
|
@@ -194,7 +192,7 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, u | |||
accessibilityLabel={translate('workspace.new.newWorkspace')} | |||
success | |||
text={translate('workspace.new.newWorkspace')} | |||
onPress={() => App.createWorkspaceAndNavigateToIt('', false, '', false, !isSmallScreenWidth)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gedu Shouldn't we update all instances of createWorkspaceAndNavigateToIt
? Or is it intentionally updated only for this specific case? The lack of updating other occurrences has resulted in inconsistency. For example, when creating a new workspace from the global menu, it still navigates to the workspace #admins room.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I think we do not need this in the other flows either.
Details
Created 2 new keys to save Policy and PolicyMembers information,
PolicyDraft
andPolicyMembersDraft
. Those keys are filled with basic Policy information just for fast navigation to the Workspace Init Page, where those drafts are removed and the Policy data are saved and a request is made.Fixed Issues
$ #16935
PROPOSAL: #16935 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
createWorkspace_android.mp4
Android: mWeb Chrome
createWorkspace_androidWeb.mp4
iOS: Native
createWorkspace_iphone.mp4
iOS: mWeb Safari
createWorkspace_iphoneWeb.mp4
MacOS: Chrome / Safari
createWorkspace_chrome.mp4
createWorkspace_safari.mp4
MacOS: Desktop
createWorkspace_desktop.mp4