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-12-07] [$250] Tag rules - Approver field in tag editor shows user email instead of user name #52678

Closed
7 of 8 tasks
IuliiaHerets opened this issue Nov 17, 2024 · 22 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

@IuliiaHerets
Copy link

IuliiaHerets commented Nov 17, 2024

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


Version Number: 9.0.63-3
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Workflows.
  3. Click on the existing approval workflow under Add approvals.
  4. Note that Approver field shows user name.
  5. Go to workspace settings > Tags.
  6. Click on any tag.
  7. Click Approver.
  8. Select a user with custom name.

Expected Result:

Approver field in tag editor will show user name.

Actual Result:

Approver field in tag editor shows user email instead of user name.

In Category editor, Approver field shows user name.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bandicam.2024-11-16.22-36-42-497.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021858313853614949592
  • Upwork Job ID: 1858313853614949592
  • Last Price Increase: 2024-11-18
  • Automatic offers:
    • etCoderDysto | Contributor | 104985198
Issue OwnerCurrent Issue Owner: @kadiealexander
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 17, 2024
Copy link

melvin-bot bot commented Nov 17, 2024

Triggered auto assignment to @kadiealexander (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.

@etCoderDysto
Copy link
Contributor

etCoderDysto commented Nov 17, 2024

Proposal

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

Approver field in tag editor shows user email instead of user name

What is the root cause of that problem?

We are getting the approvers email address here

const tagApprover = PolicyUtils.getTagApproverRule(policyID, route.params.tagName)?.approver;

And we are displying the email address

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

We should get user's display name using PersonalDetailsUtils.getPersonalDetailByEmail(tagApprover)?.displayName;
And display the user display name when it is available and fallback to displaying the user email when display name is not available

Code implementation

    const tagApprover = PolicyUtils.getTagApproverRule(policyID, route.params.tagName)?.approver ?? '';
    const approver = PersonalDetailsUtils.getPersonalDetailByEmail(tagApprover)?.displayName;

Note: we can use useMemo to optimize recalculating displayName as we do on categories page

What alternative solutions did you explore? (Optional)

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 17, 2024

Edited by proposal-police: This proposal was edited at 2024-11-18 04:57:50 UTC.

Proposal

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

Tag rules - Approver field in tag editor shows user email instead of user name

What is the root cause of that problem?

We display this display name --> email in CategorySettingsPage

const approverText = useMemo(() => {
const categoryApprover = CategoryUtils.getCategoryApproverRule(policy?.rules?.approvalRules ?? [], categoryName)?.approver ?? '';
const approver = PersonalDetailsUtils.getPersonalDetailByEmail(categoryApprover);
return approver?.displayName ?? categoryApprover;
}, [categoryName, policy?.rules?.approvalRules]);

But we only display the text returns from getTagApproverRule function which is the user email

const tagApprover = PolicyUtils.getTagApproverRule(policyID, route.params.tagName)?.approver;

title={tagApprover ?? ''}

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

In TagSettingsPage, we should do the same way here to display the tag approver display name first.

I notice that we need to use || because approverDetails?.displayName can be an empty string if the user doesn't have a custom display name. And we need to fix the same in CategorySettingsPage

const tagApprover = useMemo(() => {
    const tagApproverEmail = PolicyUtils.getTagApproverRule(policyID, route.params.tagName)?.approver ?? '';
    const approverDetails = getPersonalDetailByEmail(tagApproverEmail);
    return approverDetails?.displayName || tagApproverEmail;
}, [policyID, route.params.tagName]);

const tagApprover = PolicyUtils.getTagApproverRule(policyID, route.params.tagName)?.approver;

title={tagApprover ?? ''}

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@etCoderDysto
Copy link
Contributor

Proposal updated:

Added code implementation details

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Nov 18, 2024
Copy link

melvin-bot bot commented Nov 18, 2024

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

@melvin-bot melvin-bot bot changed the title Tag rules - Approver field in tag editor shows user email instead of user name [$250] Tag rules - Approver field in tag editor shows user email instead of user name Nov 18, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 18, 2024
Copy link

melvin-bot bot commented Nov 18, 2024

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

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 18, 2024

Updated proposal.

  • Add an edge case.

@eh2077
Copy link
Contributor

eh2077 commented Nov 19, 2024

Thank you for your speedy proposals!

This issue is straightforward and @etCoderDysto 's proposal was first, so let's go with their proposal!

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Nov 19, 2024

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

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 19, 2024

@eh2077 Could you please check again

  1. This implementation isn't correct, it doesn't fallback to the approver email if the display name is empty or undefined
const approver = PersonalDetailsUtils.getPersonalDetailByEmail(tagApprover)?.displayName;

I notice that we need to use || because approverDetails?.displayName can be an empty string if the user doesn't have a custom display name. And we need to fix the same in CategorySettingsPage

  1. If we use the same way with CategorySettingsPage, we need to use || instead of ?? because displayName can be an empty string.

@eh2077
Copy link
Contributor

eh2077 commented Nov 19, 2024

@mkzie2 Thanks for your comment. I voted for @etCoderDysto 's proposal because I think the initial version of their proposal is clear to fix this straightforward issue.

If we use the same way with CategorySettingsPage, we need to use || instead of ?? because displayName can be an empty string.

I appreciated your discussion on this though I believe this won't be an issue for most use cases because we're not allowed to save empty display name.

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 19, 2024

I appreciated your discussion on this though I believe this won't be an issue for most use cases because we're not allowed to save empty display name.

The user can skip the onboarding if it's a new account that is invited to a WS or an existing user creates an expense with this user before the new user login the first time.

@etCoderDysto
Copy link
Contributor

etCoderDysto commented Nov 19, 2024

The user can skip the onboarding if it's a new account that is invited to a WS or an existing user creates an expense with this user before the new user login the first time.

  • Only firstName, and lastName can be empty string in the above scenario, displayName resorts to user email when the user doesn't have firstName and lastName
Screenshot 2024-11-19 at 8 00 07 in the evening
  • And approver field will filled will display user's email if we follow the same pattern as CategorySettingsPage
Screenshot 2024-11-19 at 8 03 22 in the evening

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

melvin-bot bot commented Nov 20, 2024

📣 @etCoderDysto 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 30, 2024
@melvin-bot melvin-bot bot changed the title [$250] Tag rules - Approver field in tag editor shows user email instead of user name [HOLD for payment 2024-12-07] [$250] Tag rules - Approver field in tag editor shows user email instead of user name Nov 30, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 30, 2024
Copy link

melvin-bot bot commented Nov 30, 2024

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

Copy link

melvin-bot bot commented Nov 30, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.68-7 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-12-07. 🎊

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

Copy link

melvin-bot bot commented Nov 30, 2024

@eh2077 @kadiealexander @eh2077 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 7, 2024
@kadiealexander
Copy link
Contributor

kadiealexander commented Dec 9, 2024

Payments due:

@kadiealexander
Copy link
Contributor

@eh2077 please don't forget the checklist!

@melvin-bot melvin-bot bot added the Overdue label Dec 11, 2024
@eh2077
Copy link
Contributor

eh2077 commented Dec 11, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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/48325/files#r1880057860

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

I don't think we need to add a new regression test because

  1. The fix is a minor and straightforward improvement about approver name display
  2. It doesn't impact user flow
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Do we agree 👍 or 👎

@eh2077
Copy link
Contributor

eh2077 commented Dec 11, 2024

Requested payment in NewDot

@JmillsExpensify
Copy link

$250 approved for @eh2077

@melvin-bot melvin-bot bot removed the Overdue label Dec 12, 2024
@github-project-automation github-project-automation bot moved this from Product (CRITICAL) to Done in [#whatsnext] #retain Dec 12, 2024
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
Status: DONE
Development

No branches or pull requests

7 participants