Skip to content
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

[Awaiting Payment][$1000] Web - Workspace - Concierge opens and #admin with WS settings close after coming from OD #23566

Closed
1 of 6 tasks
kbecciv opened this issue Jul 25, 2023 · 49 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jul 25, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Issue found when executing PR #22619

Action Performed:

  1. Go to staging.expensify.com
  2. Log in with a new Gmail account.
  3. Go to Settings > Policies > Group > New Policy.

Expected Result:

User is navigated to #admins page report and also to the workspace details on the right.

Actual Result:

User is navigated to #admins page report and also to the workspace details on the right for a few seconds, then Concierge chat opens and workspace details panel closes.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.45-3
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
Notes/Photos/Videos: Any additional supporting documentation

Bug6141132_20230725_220442.mp4

Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c12a52f499c32c9c
  • Upwork Job ID: 1684298824142127104
  • Last Price Increase: 2023-08-02
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@garrettmknight garrettmknight added the External Added to denote the issue can be worked on by a contributor label Jul 26, 2023
@melvin-bot melvin-bot bot changed the title Web - Workspace - Concierge opens and #admin with WS settings close after coming from OD [$1000] Web - Workspace - Concierge opens and #admin with WS settings close after coming from OD Jul 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01c12a52f499c32c9c

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

Current assignee @garrettmknight is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

@StefanNemeth
Copy link
Contributor

StefanNemeth commented Jul 27, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

When a new user is creating a new group on staging.expensify.com (Settings > Policies > Group), we want them to be redirected to #admins page report and open workspace details instead of just showing the Concierge chat.

What is the root cause of that problem?

The root cause of the problem is that for new users the function Welcome.show displays the Workspace chat after logging in for the first time (which happens AFTER the admin chat is opened):

// We want to display the Workspace chat first since that means a user is already in a Workspace and doesn't need to create another one
const workspaceChatReport = _.find(
allReports,
(report) => ReportUtils.isPolicyExpenseChat(report) && report.ownerAccountID === currentUserAccountID && report.statusNum !== CONST.REPORT.STATUS.CLOSED,
);
if (workspaceChatReport && !isDisplayingWorkspaceRoute) {
// This key is only updated when we call ReconnectApp, setting it to false now allows the user to navigate normally instead of always redirecting to the workspace chat
Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false);
Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID));

This chat (workspaceChatReport) only exists briefly due to optimistic data when calling Policy.createWorkspace

App/src/libs/actions/Policy.js

Lines 1012 to 1021 in 975146f

{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${expenseChatReportID}`,
value: {
pendingFields: {
addWorkspaceRoom: null,
},
pendingAction: null,
},
},

When actually opening the workspace chat, the user is "redirected" to the Concierge chat as the workspaceChatReport does not really exist in the back-end

// navigate to concierge when the room removed from another device (e.g. user leaving a room)
// the report will not really null when removed, it will have defaultProps properties and values
if (
prevOnyxReportID &&
prevOnyxReportID === routeReportID &&
!onyxReportID &&
// non-optimistic case
(_.isEqual(this.props.report, defaultProps.report) ||
// optimistic case
(prevProps.report.statusNum === CONST.REPORT.STATUS.OPEN && this.props.report.statusNum === CONST.REPORT.STATUS.CLOSED))
) {
Navigation.goBack();
Report.navigateToConciergeChat();

So the current navigation for newly logged in users is:
Admin chat -> Workspace chat (does not exist) -> Concierge chat

What changes do you think we should make in order to solve the problem?

Within the Welcome.show (https://github.com/Expensify/App/blob/975146fa30bc65a19df8e0cca525af32ce2ceda5/src/libs/actions/Welcome.js#L107C1-L107C1) functionality we could check whether the openOnAdminRoom parameter is set and extend the already existing variable isDisplayingWorkspaceRoute

const openOnAdminRoom = lodashGet(topRoute, 'params.openOnAdminRoom', false);

// If we already opened the workspace settings or want the admin room to stay open, do not
// navigate to another report
const shouldNavigateToWorkspaceChat = !isWorkspaceRoute && !exitingToWorkspaceRoute && !openOnAdminRoom;

if (workspaceChatReport && shouldNavigateToWorkspaceChat) {
  // ... Find workspace chat and navigate (see above)
}

That way the user stays on the admin report page and the workspace details won't close if the openOnAdminRoom parameter is set.

Additionally, we will have to change the findLastAccessedReport method which will ultimately be called when the user closes the workspace settings to determine what chat to show them. There is already code for the case that openOnAdminRoom is set, however we will have to move it a few lines up so that it will also be executed if the user is a first time user. Without this change, the concierge chat will open after closing the workspace settings.

App/src/libs/ReportUtils.js

Lines 501 to 524 in cf4e837

if (isFirstTimeNewExpensifyUser) {
if (sortedReports.length === 1) {
return sortedReports[0];
}
return _.find(sortedReports, (report) => !isConciergeChatReport(report));
}
if (ignoreDomainRooms) {
// We allow public announce rooms, admins, and announce rooms through since we bypass the default rooms beta for them.
// Check where ReportUtils.findLastAccessedReport is called in MainDrawerNavigator.js for more context.
// Domain rooms are now the only type of default room that are on the defaultRooms beta.
sortedReports = _.filter(
sortedReports,
(report) => !isDomainRoom(report) || getPolicyType(report, policies) === CONST.POLICY.TYPE.FREE || hasExpensifyGuidesEmails(lodashGet(report, ['participantAccountIDs'], [])),
);
}
let adminReport;
if (openOnAdminRoom) {
adminReport = _.find(sortedReports, (report) => {
const chatType = getChatType(report);
return chatType === CONST.REPORT.CHAT_TYPE.POLICY_ADMINS;
});
}

What alternative solutions did you explore? (Optional)

As an alternative we could check whether the user is already on a report page and not redirect if that is the case. Removing the workspace chat from the optimistic data might be an option, but that could lead to other issues.

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

📣 @StefanNemeth! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@StefanNemeth
Copy link
Contributor

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~018932ede2567df655

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@melvin-bot melvin-bot bot added the Overdue label Jul 27, 2023
@sobitneupane
Copy link
Contributor

Thanks for the proposal @StefanNemeth. Can you please add permalinks to reference the code in our App. Also, more explanation of the solution and root cause analysis will be appreciated.

@melvin-bot melvin-bot bot removed the Overdue label Jul 28, 2023
@StefanNemeth
Copy link
Contributor

@sobitneupane Sure, I updated the proposal. I hope it is reasonable.

@melvin-bot melvin-bot bot added the Overdue label Jul 31, 2023
@garrettmknight
Copy link
Contributor

@sobitneupane can you give the updated proposal a look when you get the chance?

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2023
@sobitneupane
Copy link
Contributor

Thanks for the update @StefanNemeth.

Were you able to reproduce the issue? I cannot reproduce the issue on my end.

Screen.Recording.2023-08-02.at.13.08.33.mov

Did you test the solution of the issue?

@garrettmknight
Copy link
Contributor

@sobitneupane just tested and it's still happening. You've got to signup with a brand new gmail account on OD for it to happen.

@StefanNemeth
Copy link
Contributor

@sobitneupane I could reproduce the issue. It can only be reproduced when you create a new account on staging.expensify.com and follow the steps from above without ever going to new.staging.expensify.com so that isFirstTimeNewExpensifyUser is true.

I tested the solution and it worked.

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@sobitneupane
Copy link
Contributor

Thanks for the updated @StefanNemeth.

I tested the solution and it worked.

I am having some issues while trying to test it. When I open a new policy from staging.expensify.com, it redirects to staging.new.expensify.com. So, I was unable to test the local change. How did you test it?

@StefanNemeth
Copy link
Contributor

I am having some issues while trying to test it. When I open a new policy from staging.expensify.com, it redirects to staging.new.expensify.com. So, I was unable to test the local change. How did you test it?

@sobitneupane I went to staging.expensify.com and just when it redirected me to staging.new.expensify.com I copied the URL, closed the tab and used the URL params for my local environment.

Kapture.2023-08-02.at.19.48.08.mp4

@dangrous
Copy link
Contributor

Okay great! That's helpful to confirm we did the right thing. Sorry to bother you while you were OOO!

@dangrous
Copy link
Contributor

@garrettmknight double check my math but I believe we're ready to go for payment here (Melvin is not cooperating) since this was deployed to prod on 8/23

@garrettmknight
Copy link
Contributor

Yep, just noticed a rash of this type of issues where Melv missed them. On it!

@garrettmknight
Copy link
Contributor

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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] 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:
  • [@sobitneupane] 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:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] 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.
  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@garrettmknight garrettmknight added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Sep 4, 2023
@garrettmknight
Copy link
Contributor

garrettmknight commented Sep 4, 2023

Summary of payments for this issue:

#urgency bonus? No
Reporter: N/A
Contirbutor: @StefanNemeth - $1000 paid via upwork
Contributor+: @sobitneupane - $1000

Upwork job: https://www.upwork.com/jobs/~01c12a52f499c32c9c

@garrettmknight
Copy link
Contributor

@StefanNemeth can you accept the new Upwork job and I'll pay? Thanks!

@garrettmknight garrettmknight added Daily KSv2 and removed Weekly KSv2 labels Sep 4, 2023
@garrettmknight garrettmknight changed the title [$1000] Web - Workspace - Concierge opens and #admin with WS settings close after coming from OD [Awaiting Payment][$1000] Web - Workspace - Concierge opens and #admin with WS settings close after coming from OD Sep 4, 2023
@garrettmknight
Copy link
Contributor

Paid!

@sobitneupane
Copy link
Contributor

sobitneupane commented Sep 5, 2023

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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

This is an old issue and was probably introduced by this PR

  • [@sobitneupane] 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:

#8855 (comment)

  • [@sobitneupane] 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:
  • [@sobitneupane] Determine if we should create a regression test for this bug.

yes

  • [@sobitneupane] 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.

#23566 (comment)

@sobitneupane
Copy link
Contributor

Regression Test Proposal

  1. Go to staging.expensify.com and login with a new account
  2. Go to Settings > Policies > Group
  3. Select Free Policy
  4. Verify that User is navigated to #admins page report with workspace details on RHP.

Do we agree 👍 or 👎

@dangrous
Copy link
Contributor

dangrous commented Sep 5, 2023

I might modify very slightly:

  1. Go to staging.expensify.com and login with a new account
  2. Go to Settings > Policies > Group
  3. Select Free Policy
  4. Verify that User is navigated to #admins page report with workspace details open in the RHP.
  5. Verify that closing the RHP puts the user in the #admins report.

Just to make that last bit a little more clear

@sobitneupane
Copy link
Contributor

Requested payment on newDot.

#23566 (comment)

@JmillsExpensify
Copy link

$1,000 payment approved via NewDot based on BZ summary.

@melvin-bot melvin-bot bot added the Overdue label Sep 10, 2023
@JmillsExpensify
Copy link

Leaving this issue open for the regression test.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Daily KSv2 Overdue labels Sep 11, 2023
@garrettmknight
Copy link
Contributor

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants