You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-02-07] [$500] Room - Unable to create a public room if I don't select a workspace #34647
Version Number: 1.4.26.1 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
changed the title [-]Room - Unable to create a public room if I don't select a workspace[/-][+][$500] Room - Unable to create a public room if I don't select a workspace[/+]on Jan 17, 2024
Please re-state the problem that we are trying to solve in this issue
Unable to create a public room. "Unexpected error creating this chat, please try again laterPolicy rooms can not be created on personal policies".
What is the root cause of that problem?
Recently this PR #34160 introduced the Default workspace rooms to active workspace functionality but did not take into account when validating to make sure the policyID (activePolicyID set at mount) actually exist within workspaceOptions (available workspaces to select).
What this does at mount is to set a policyID that doesn't exist within workspaceOptions, which causes the form to already have a valid workspace assigned which is not within the available options - hence why we can't see any workspace selected in the UI but the validation passes.
What changes do you think we should make in order to solve the problem?
In the code block above the if condition we should also check if the current state value of policyID (activePolicyID set at mount) exists within the available workspaceOptions and if not, display workspace not selected error.
Please re-state the problem that we are trying to solve in this issue.
Room - Unable to create a public room if I don't select a workspace
What is the root cause of that problem?
If account has activePolicyID, it's automatically selected as default.
This is problematic when policy linked to that policyID should not be visible in newDot (i.e. control policy)
So UI states that workspace is unselected but actually it's selected and sent to sever when create new room
What changes do you think we should make in order to solve the problem?
Add more validation whether policy linked to values.policyID exists or not in workspaceOptions using same filter condition used in PolicyUtils.getActivePolicies
Please re-state the problem that we are trying to solve in this issue.
Can create a public room without selecting a workspace, but results in errors. When trying to create a public room, error message to select a workspace should be shown to the user
The problem is that there are cases that activePolicyID isn't included in public workspaces. The workspace options include only public workspaces, but activePolicyID indicates private workspace. So the validation doesn't fails, but it looks like workspace field is empty
This is the root cause
What changes do you think we should make in order to solve the problem?
We need to clear the policyID when it isn't a public workspace
Please re-state the problem that we are trying to solve in this issue.
Unable to create a public room. "Unexpected error creating this chat, please try again laterPolicy rooms can not be created on personal policies".
What is the root cause of that problem?
The active policy is the expense default of the account. But it's hidden in workspaceOptions because getActivePolicies only returns true for policy has isPolicyExpenseChatEnabled or areChatRoomsEnabled is true.
What changes do you think we should make in order to solve the problem?
We should remove this condition now policy.isPolicyExpenseChatEnabled || policy.areChatRoomsEnabled since we always choose the default policy by default.
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@thesahindia] The PR that introduced the bug has been identified. Link to the PR:
[@thesahindia] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@thesahindia] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@thesahindia] Determine if we should create a regression test for this bug.
Done
[@thesahindia] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Activity
[-]Room - Unable to create a public room if I don't select a workspace[/-][+][$500] Room - Unable to create a public room if I don't select a workspace[/+]melvin-bot commentedon Jan 17, 2024
Job added to Upwork: https://www.upwork.com/jobs/~014dfbb95a9411a4d8
melvin-bot commentedon Jan 17, 2024
Triggered auto assignment to @trjExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jan 17, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)ikevin127 commentedon Jan 17, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue
Unable to create a public room. "Unexpected error creating this chat, please try again laterPolicy rooms can not be created on personal policies".
What is the root cause of that problem?
Recently this PR #34160 introduced the
Default workspace rooms to active workspacefunctionality but did not take into account when validating to make sure thepolicyID(activePolicyID set at mount) actually exist withinworkspaceOptions(available workspaces to select).What this does at mount is to set a
policyIDthat doesn't exist within workspaceOptions, which causes the form to already have a valid workspace assigned which is not within the available options - hence why we can't see any workspace selected in the UI but the validation passes.What changes do you think we should make in order to solve the problem?
App/src/pages/workspace/WorkspaceNewRoomPage.js
Line 190 in 3033f99
In the code block above the if condition we should also check if the current state value of policyID (activePolicyID set at mount) exists within the available
workspaceOptionsand if not, display workspace not selected error.Videos
MacOS: Chrome / Safari
Screen.Recording.2024-01-17.at.17.04.47.mov
mkhutornyi commentedon Jan 17, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Room - Unable to create a public room if I don't select a workspace
What is the root cause of that problem?
If account has
activePolicyID, it's automatically selected as default.This is problematic when policy linked to that policyID should not be visible in newDot (i.e. control policy)
So UI states that workspace is unselected but actually it's selected and sent to sever when create new room
What changes do you think we should make in order to solve the problem?
App/src/pages/workspace/WorkspaceNewRoomPage.js
Lines 190 to 192 in 3033f99
Add more validation whether policy linked to
values.policyIDexists or not inworkspaceOptionsusing same filter condition used inPolicyUtils.getActivePoliciesdummy-1111 commentedon Jan 17, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Can create a public room without selecting a workspace, but results in errors. When trying to create a public room, error message to select a workspace should be shown to the user
What is the root cause of that problem?
We initialize the
policyIDhereApp/src/pages/workspace/WorkspaceNewRoomPage.js
Line 103 in 3033f99
We also initialize the public workspace options here
App/src/pages/workspace/WorkspaceNewRoomPage.js
Lines 199 to 207 in 3033f99
The problem is that there are cases that
activePolicyIDisn't included in public workspaces. The workspace options include only public workspaces, butactivePolicyIDindicates private workspace. So the validation doesn't fails, but it looks like workspace field is emptyThis is the root cause
What changes do you think we should make in order to solve the problem?
We need to clear the
policyIDwhen it isn't a public workspaceUpdate
App/src/pages/workspace/WorkspaceNewRoomPage.js
Line 103 in 3033f99
to
Update
App/src/pages/workspace/WorkspaceNewRoomPage.js
Lines 145 to 150 in 3033f99
to
This works as expected
Result
34647.mp4
What alternative solutions did you explore? (Optional)
dukenv0307 commentedon Jan 17, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Unable to create a public room. "Unexpected error creating this chat, please try again laterPolicy rooms can not be created on personal policies".
What is the root cause of that problem?
The active policy is the expense default of the account. But it's hidden in
workspaceOptionsbecausegetActivePoliciesonly returns true for policy hasisPolicyExpenseChatEnabledorareChatRoomsEnabledis true.App/src/pages/workspace/WorkspaceNewRoomPage.js
Line 149 in 3033f99
What changes do you think we should make in order to solve the problem?
We should remove this condition now
policy.isPolicyExpenseChatEnabled || policy.areChatRoomsEnabledsince we always choose the default policy by default.App/src/libs/PolicyUtils.ts
Line 19 in 3033f99
What alternative solutions did you explore? (Optional)
We can check if the active policy of this accout isn't enable now, we can choose the first policy from
workspaceOptionstrjExpensify commentedon Jan 17, 2024
Asking about this one in #vip-vsb here: https://expensify.slack.com/archives/C066HJM2CAZ/p1705526775582279
I'm unsure of:
If not on #2, my suggestion is to show an in-line form error to "Please choose a workspace", as the only options should be group workspace types.
58 remaining items
trjExpensify commentedon Feb 12, 2024
Same Melv, awaiting the checklist!
thesahindia commentedon Feb 12, 2024
Steps for test case -
trjExpensify commentedon Feb 14, 2024
Don't forget about the rest of the checklist? :)
As for the regression test, looks like we're going to be adding one already, so I've suggested a modification to it in that GH.
trjExpensify commentedon Feb 19, 2024
Regression test sorted, @thesahindia you need to complete the rest of the checklist so we can issue payments and close this one out.
thesahindia commentedon Feb 22, 2024
#34160
#34160 (comment)
https://expensify.slack.com/archives/C01GTK53T8Q/p1708594431270969
Done
Done
trjExpensify commentedon Feb 22, 2024
Thanks! Payment summary as follows:
Closing this out!