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

[HOLD for payment 2024-07-24] [$250] Workspace member - Hidden admin appears in the members list after changing contact method #44705

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 1, 2024 · 20 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

@lanitochka17
Copy link

lanitochka17 commented Jul 1, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.3-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: N/A
Issue reported by: Applause - Intrnal Team

Action Performed:

Precondition: Use Gmail account to login

  1. Create workspace
  2. Go to WS members - only owner is shown
  3. Go to Account settings > Profile > Contact method
  4. Add new email as a contact method
  5. Verify new added email
  6. Set added email as default
  7. Go to WS > Members

Expected Result:

Only owner (with a new email) shown in the members list

Actual Result:

Second member as Hidden (Admin) appears in the list. When user clicks on it 'Hmm.. it's not here page' opens

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6530381_1719863704034.ws_admin.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014a16dfba8ca4a44e
  • Upwork Job ID: 1810351284921394393
  • Last Price Increase: 2024-07-08
  • Automatic offers:
    • rayane-djouah | Reviewer | 103066635
Issue OwnerCurrent Issue Owner: @anmurali
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 1, 2024
Copy link

melvin-bot bot commented Jul 1, 2024

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@devguest07
Copy link
Contributor

Proposal

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

Workspace member - Hidden admin appears in the members list after changing contact method

What is the root cause of that problem?

After adding a second email as a contact method and setting it as the default, the policy.employeeList will include both the old and new emails as contact methods.

Object.entries(policy?.employeeList ?? {}).forEach(([email, policyEmployee]) => {

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

To resolve this issue, it's preferable to reference the data within loginList, which contains all login email addresses. For each entry in policy?.employeeList, if the email exists in loginList and is not equal to policy.owner, it should not be displayed.

// Skip emails that exist in loginList and are not equal to policy.owner 
if (loginList.includes(email) && email !== policy?.owner) { return; }

Note: We can consider using policy.owner to determine if an email should be excluded. The main goal here is to prevent any secondary email that exists in loginList from being displayed.

What alternative solutions did you explore?

@bernhardoj
Copy link
Contributor

Proposal

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

Owner account and Hidden user shows after updating default contact method.

What is the root cause of that problem?

When we update the default contact method, we optimistically update the policy owner to the new default contact method.

Object.values(policies ?? {}).forEach((policy) => {
if (policy?.ownerAccountID !== currentUserAccountID) {
return;
}
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policy.id}`,
value: {
owner: newDefaultContactMethod,
},
});

However, the previous contact method is still listed in the policy employeeList. The reason the previous contact method shows as Hidden is that we also optimistically update the personal details of the user to the new contact method (email), so the app can't find the previous personal detail anymore.

onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
value: {
[currentUserAccountID]: {
login: newDefaultContactMethod,
displayName: PersonalDetailsUtils.createDisplayName(newDefaultContactMethod, myPersonalDetails),
},
},

The badge shows admin because it's not the owner anymore.

When we open the ws members page, the BE response will merge the new contact method to the ws member list.

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

Optimistically remove the previous contact method and add the new one to the ws member list.

Object.values(policies ?? {}).forEach((policy) => {
if (policy?.ownerAccountID !== currentUserAccountID) {
return;
}
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policy.id}`,
value: {
owner: newDefaultContactMethod,
},
});
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policy.id}`,
value: {
owner: policy.owner,
},
});
});

employeeList: {
    [oldDefaultContactMethod]: null,
    [newDefaultContactMethod]: {
        role: 'admin'
    },
},

(and revert it when fails)

@melvin-bot melvin-bot bot added the Overdue label Jul 4, 2024
Copy link

melvin-bot bot commented Jul 5, 2024

@anmurali Whoops! This issue is 2 days overdue. Let's get this updated quick!

@anmurali
Copy link

anmurali commented Jul 8, 2024

Can reproduce on staging

@melvin-bot melvin-bot bot removed the Overdue label Jul 8, 2024
@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Jul 8, 2024
@melvin-bot melvin-bot bot changed the title Workspace member - Hidden admin appears in the members list after changing contact method [$250] Workspace member - Hidden admin appears in the members list after changing contact method Jul 8, 2024
Copy link

melvin-bot bot commented Jul 8, 2024

Job added to Upwork: https://www.upwork.com/jobs/~014a16dfba8ca4a44e

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

melvin-bot bot commented Jul 8, 2024

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

@rayane-djouah
Copy link
Contributor

rayane-djouah commented Jul 9, 2024

Can reproduce on staging 👍

Screen.Recording.2024-07-10.at.12.18.46.AM.mov

Reviewing proposals...

@rayane-djouah
Copy link
Contributor

@bernhardoj's proposal LGTM

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 9, 2024

Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 10, 2024
Copy link

melvin-bot bot commented Jul 10, 2024

📣 @rayane-djouah 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@bernhardoj
Copy link
Contributor

PR is ready

cc: @rayane-djouah

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jul 17, 2024
@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Jul 17, 2024
@melvin-bot melvin-bot bot changed the title [$250] Workspace member - Hidden admin appears in the members list after changing contact method [HOLD for payment 2024-07-24] [$250] Workspace member - Hidden admin appears in the members list after changing contact method Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.7-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-07-24. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jul 17, 2024

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:

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 23, 2024
@bernhardoj
Copy link
Contributor

Requested in ND.

@rayane-djouah
Copy link
Contributor

rayane-djouah commented Jul 25, 2024

  • The PR that introduced the bug has been identified. Link to the PR: fix: Unable to select members after adding them to the workspace #36713
  • 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: https://github.com/Expensify/App/pull/36713/files#r1691350597
  • 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: N/A
  • Determine if we should create a regression test for this bug. Yes
  • 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.

Regression Test Proposal

  1. Create a new workspace
  2. Go to WS members
  3. Verify there is only 1 member shown (the owner)
  4. Go to Account settings > Profile > Contact method
  5. Add a contact method
  6. Make the new account method default
  7. Go to WS > Members
  8. Verify there is only 1 member shown (the owner with the new contact method) (there is no Hidden member shown)

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Jul 25, 2024
Copy link

melvin-bot bot commented Jul 26, 2024

@anmurali, @blimpich, @bernhardoj, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick!

@anmurali
Copy link

anmurali commented Jul 26, 2024

@melvin-bot melvin-bot bot removed the Overdue label Jul 26, 2024
@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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

7 participants