Skip to content

Commit

Permalink
Merge pull request #10600 from Expensify/alberto-removeKey
Browse files Browse the repository at this point in the history
Remove the usage of IS_CREATING_WORKSPACE
  • Loading branch information
arosiclair authored Aug 29, 2022
2 parents d9b01d4 + fd09841 commit 28c6f43
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 16 deletions.
3 changes: 0 additions & 3 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export default {
// Boolean flag set whenever the sidebar has loaded
IS_SIDEBAR_LOADED: 'isSidebarLoaded',

// Boolean flag set when workspace is being created
IS_CREATING_WORKSPACE: 'isCreatingWorkspace',

// Note: These are Persisted Requests - not all requests in the main queue as the key name might lead one to believe
PERSISTED_REQUESTS: 'networkRequestQueue',

Expand Down
2 changes: 0 additions & 2 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@ function updateAllPolicies(policyCollection) {
* @returns {Promise}
*/
function create(name = '') {
Onyx.set(ONYXKEYS.IS_CREATING_WORKSPACE, true);
let res = null;
return DeprecatedAPI.Policy_Create({type: CONST.POLICY.TYPE.FREE, policyName: name})
.then((response) => {
Onyx.set(ONYXKEYS.IS_CREATING_WORKSPACE, false);
if (response.jsonCode !== 200) {
// Show the user feedback
const errorMessage = Localize.translateLocal('workspace.new.genericFailureMessage');
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class BaseSidebarScreen extends Component {
onSelected: () => Navigation.navigate(ROUTES.IOU_BILL),
},
] : []),
...(!this.props.isCreatingWorkspace && !Policy.isAdminOfFreePolicy(this.props.allPolicies) ? [
...(!Policy.isAdminOfFreePolicy(this.props.allPolicies) ? [
{
icon: Expensicons.NewWorkspace,
iconWidth: 46,
Expand Down
3 changes: 0 additions & 3 deletions src/pages/home/sidebar/SidebarScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,5 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
isCreatingWorkspace: {
key: ONYXKEYS.IS_CREATING_WORKSPACE,
},
}),
)(SidebarScreen);
3 changes: 0 additions & 3 deletions src/pages/home/sidebar/SidebarScreen/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
isCreatingWorkspace: {
key: ONYXKEYS.IS_CREATING_WORKSPACE,
},
}),
)(SidebarScreen);
4 changes: 0 additions & 4 deletions src/pages/home/sidebar/SidebarScreen/sidebarPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ const sidebarPropTypes = {
/* Beta features list */
betas: PropTypes.arrayOf(PropTypes.string),

/* Is workspace is being created by the user? */
isCreatingWorkspace: PropTypes.bool,

...windowDimensionsPropTypes,

...withLocalizePropTypes,
};

const sidebarDefaultProps = {
isCreatingWorkspace: false,
allPolicies: {},
betas: [],
};
Expand Down

0 comments on commit 28c6f43

Please sign in to comment.