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

Wrong email sent during auto-reimbursement #52800

Closed
ryanschaffer opened this issue Nov 20, 2024 · 16 comments
Closed

Wrong email sent during auto-reimbursement #52800

ryanschaffer opened this issue Nov 20, 2024 · 16 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review

Comments

@ryanschaffer
Copy link

Version Number: v9.0.63-3
Reproducible in staging?: Unsure
Reproducible in production?: Unsure
**If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Unsure
**If this was caught during regression testing, add the test name, ID and link from TestRail: No
Email or phone of affected tester (no customers): [email protected]
Logs: N/A
Expensify/Expensify Issue URL: Made it here and not E/E.
Issue reported by: Ryan Schaffer
Slack conversation (hyperlinked to channel name): #retain: https://expensify.slack.com/archives/C07NZ8B1VTQ/p1732050274936679

Action Performed:

  1. Approve expense
  2. Expense gets auto-reimbursed
  3. Received incorrect email

Expected Result:

I expected to receive an email that said Expensify US paid David Bondy $23.36.

Actual Result:

I got an email that said Expensify US paid you $23.26.
(This made me think that I received money, but the YOU being referred to in the email subject is David Bondy, not me. I received the email that David Bondy should have got.)

Workaround:

Yes, but this is bad UX.

Platforms:

This is an email issue, so backend. Not platform dependent (I don't think).

Screenshots/Videos

image image
@ryanschaffer ryanschaffer added Daily KSv2 Internal Requires API changes or must be handled by Expensify staff Bug Something is broken. Auto assigns a BugZero manager. labels Nov 20, 2024
Copy link

melvin-bot bot commented Nov 20, 2024

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

@ryanschaffer
Copy link
Author

@blimpich Is knowledgable in this area. Not sure if he has the bandwidth to pick it up or not, but can be a resource.

@blimpich blimpich added the Hot Pick Ready for an engineer to pick up and run with label Nov 20, 2024
@VictoriaExpensify
Copy link
Contributor

There is some other work going on with incorrect emails here. I'm not sure they are entirely related, but they seem similar

@blimpich
Copy link
Contributor

Can't pick up right now but will keep on radar

@VictoriaExpensify
Copy link
Contributor

@Beamanator any chance this is related to the work you're doing on email notifications?

@Beamanator
Copy link
Contributor

It looooks like here's the logs: https://staging.expensify.com/_devportal/tools/logSearch/#query=request_id:(%228e524bf999002b88-LAX%22)+AND+timestamp:[2024-11-19T17:34:55.263Z+TO+2024-11-19T19:34:55.263Z]&index=logs_expensify-031280

I will continue looking in a minute 😅

@Beamanator Beamanator self-assigned this Nov 20, 2024
@Beamanator Beamanator removed the Hot Pick Ready for an engineer to pick up and run with label Nov 20, 2024
@Beamanator
Copy link
Contributor

ReportUtils - Queued notifications for payment receipt ~~ payerEmail: '[email protected]' payeeEmail: '[email protected]'

Hmmmmmmmm

@Beamanator
Copy link
Contributor

requestedTo: 'Expenses - Expensify US' 👍
subject: 'Expenses - Expensify US paid you $23.36' ❌

Looks like ^ comes from $payeeSubject here which should only be used as the email subject if $forPayer is false, and that comes from sendWalletPaymentReceipt here...

I think the problem is that there's only 2 notifiable participants on the account..l

ReportUtils - Found notifiable participants ~~ participantAccountIDs: '[0: '1381556' 1: '4314165']'

... Which are Ryan & [email protected]

So we somehow thought ryan was being paid at this point

@Beamanator
Copy link
Contributor

@lakchote and @rlinoz seem to also have a lot of context in the area i believe, hopefully 1 of them can help in the next few days? 🙏

@trjExpensify
Copy link
Contributor

Coming from the thread. Just a note that we're keen to consolidate to the one email subject to both the payer and payee (the real one though! 😅) with the subjectLine: [%payerFirstName% || %workspaceName%] paid %payeeFirstName% %amount%

If a name isn't set, we should still fallback on the primaryLogin as standard.

@Beamanator
Copy link
Contributor

Love it 👍 and i wish i understood how to make that simple sounding change, but our notification-creating code is kinda a webby mess so I am hoping someone with more context (those ping'd before & ben) could figure this out quicker than me

@rlinoz
Copy link
Contributor

rlinoz commented Nov 20, 2024

I think it goes wrong in this line: https://github.com/Expensify/Web-Expensify/blob/9b5bb16df975eadfd724db63ac01aa6c184920dd/lib/ReportUtils.php#L2470

We can't know for sure that the payee is the first in the $participantAccountIDs array.

We probably want to find the accountID of the submitter of the report

@Beamanator
Copy link
Contributor

That soundsss pretty legit, any chance you want to take that task? :D

@rlinoz
Copy link
Contributor

rlinoz commented Nov 20, 2024

Yeah sure, I can fix the bug

@trjExpensify are we handling the subject change elsewhere?

@rlinoz rlinoz self-assigned this Nov 20, 2024
@trjExpensify
Copy link
Contributor

trjExpensify commented Nov 20, 2024 via email

@rlinoz rlinoz added the Reviewing Has a PR in review label Nov 20, 2024
@maddylewis maddylewis moved this to Product (CRITICAL) in [#whatsnext] #retain Nov 21, 2024
@rlinoz
Copy link
Contributor

rlinoz commented Nov 26, 2024

This is deployed to prod 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review
Projects
Status: Done
Development

No branches or pull requests

6 participants