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 2023-09-11] [$500] Report message naming logic is messed up #26450

Closed
JmillsExpensify opened this issue Sep 1, 2023 · 18 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 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@JmillsExpensify
Copy link

JmillsExpensify commented Sep 1, 2023

Our report message naming logic is all messed up. Here's what is going on and why it's wrong.

The correct logic for the report message name should be%submitterDisplayName & %workspaceName%, like so.
Screenshot 2023-08-31 at 21 14 45

However, currently what we have is something completely different, which is the policy owner followed by the submitter. It's reverse and also incorrectly showing the policy owner rather than the workspace name (in this case the workspace name is Expensify Contributors, which you can see in the owes report name).
Screenshot 2023-08-31 at 21 16 35

Even worse, we completely change the report message when someone pays the report. Here's another report from the same user, and now the admin who paid the report is included in the report name, again when it should be the workspace name instead.
Screenshot 2023-08-31 at 21 19 11

Good news is that the correct logic for the report message is super simple:

  • The "dual-avatar" should always be that of the workspace as well as submitter
  • The report message name should always take the form %submitterDisplayName & %workspaceName%

Additionally, in the report preview, the report name should always take the form %workspaceName% and then owes or paid

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0111ce66b26ea6258e
  • Upwork Job ID: 1697449629715591168
  • Last Price Increase: 2023-09-01
@JmillsExpensify JmillsExpensify self-assigned this Sep 1, 2023
@JmillsExpensify JmillsExpensify added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 1, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 1, 2023

Current assignee @JmillsExpensify is eligible for the Bug assigner, not assigning anyone new.

@melvin-bot melvin-bot bot changed the title Report message naming logic is messed up [$500] Report message naming logic is messed up Sep 1, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 1, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 1, 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

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

melvin-bot bot commented Sep 1, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 1, 2023

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

@DylanDylann
Copy link
Contributor

@JmillsExpensify Could you help to describe the test step for this issue?

@hoangzinh
Copy link
Contributor

hoangzinh commented Sep 1, 2023

Proposal

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

Report message naming logic is messed up

What is the root cause of that problem?

When we build display name, we always set actor & submitter name

if (displayAllActors) {
const secondaryUserDetails = props.personalDetailsList[props.iouReport.ownerAccountID] || {};
const secondaryDisplayName = lodashGet(secondaryUserDetails, 'displayName', '');
displayName = `${primaryDisplayName} & ${secondaryDisplayName}`;
secondaryAvatar = {
source: UserUtils.getAvatar(secondaryUserDetails.avatar, props.iouReport.ownerAccountID),
type: CONST.ICON_TYPE_AVATAR,
name: secondaryDisplayName,
id: props.iouReport.ownerAccountID,
};

It also happens with displaying avatars as well.

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

We should update above logic so that if the actor is WS, then we should build display name as submitter & WS name. And also apply for avatar too.

@kmwamasali
Copy link

Proposal

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

Report message naming logic is messed up

What is the root cause of that problem?

The report display name is defined in

if (isWorkspaceActor) {
displayName = ReportUtils.getPolicyName(props.report);
actorHint = displayName;
avatarSource = ReportUtils.getWorkspaceAvatar(props.report);
} else if (props.action.delegateAccountID && props.personalDetailsList[props.action.delegateAccountID]) {
// We replace the actor's email, name, and avatar with the Copilot manually for now. And only if we have their
// details. This will be improved upon when the Copilot feature is implemented.
const delegateDetails = props.personalDetailsList[props.action.delegateAccountID];
const delegateDisplayName = delegateDetails.displayName;
actorHint = `${delegateDisplayName} (${props.translate('reportAction.asCopilot')} ${displayName})`;
displayName = actorHint;
avatarSource = UserUtils.getAvatar(delegateDetails.avatar, props.action.delegateAccountID);
}
// If this is a report preview, display names and avatars of both people involved
let secondaryAvatar = {};
const displayAllActors = useMemo(() => props.action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW && props.iouReport, [props.action.actionName, props.iouReport]);
const primaryDisplayName = displayName;

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

We should get the workspace name using
showWorkspaceDetails(props.report.reportID);
And the personal details from
props.personalDetailsList[props.action.delegateAccountID]
And set them in the desired order replacing the policy name and placing the workspace name first as required in

displayName = `${primaryDisplayName} & ${secondaryDisplayName}`;

What alternative solutions did you explore? (Optional)

@trjExpensify
Copy link
Contributor

Hm, @Gonals you implemented this originally can you help? Any ideas what happened to cause a regression? Ideally we can quick time the fix/revert on this one if we can, so it's live for the activations next week.

Looking at the file history, I think it might be this PR?

@Gonals Gonals self-assigned this Sep 1, 2023
@Gonals
Copy link
Contributor

Gonals commented Sep 1, 2023

Ended up grabbing this for a quick fix. We couldn't reproduce the full issue, but after payment, we were wrongly displaying the agent's name, instead of the workspace. Fixing that.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 1, 2023
@JmillsExpensify
Copy link
Author

@Gonals thanks! I'm happy to give you access to the account I'm using. Besides the payment issue you fixed, it's the historical reports have the incorrect naming. I imagine we're just fixing things moving forward rather than retroactively?

@Gonals
Copy link
Contributor

Gonals commented Sep 1, 2023

Hmmm. Kinda weird. It is possible we stored the data differently back then 🤷. If you have an example, I can take a look, but that explains why I couldn't reproduce it in dev

@JmillsExpensify
Copy link
Author

Hmm, weird. I can't reproduce this one either now. We can disregard and I'll let you know if I see it again.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 4, 2023
@melvin-bot melvin-bot bot changed the title [$500] Report message naming logic is messed up [HOLD for payment 2023-09-11] [$500] Report message naming logic is messed up Sep 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.62-4 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 2023-09-11. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 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:

  • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
  • [@mollfpr] 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:
  • [@mollfpr] 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:
  • [@mollfpr] Determine if we should create a regression test for this bug.
  • [@mollfpr] 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.
  • [@JmillsExpensify] 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 Overdue and removed Weekly KSv2 Daily KSv2 labels Sep 11, 2023
@JmillsExpensify
Copy link
Author

@mollfpr Do you mind getting us kicked off with the checklist above and also recommending a regression test?

@melvin-bot melvin-bot bot removed the Overdue label Sep 13, 2023
@JmillsExpensify
Copy link
Author

Actually scratch that. This is an internal PR so I'm closing.

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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

7 participants