Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
2.99k stars 2.5k forks source link

Notifications - Notification shows "New Expensify" as sender when sender has no display name #41632

Closed lanitochka17 closed 1 week ago

lanitochka17 commented 2 weeks ago

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: 1.4.70-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4532040 Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

Expected Result:

App notification will show User A's email as display name

Actual Result:

App notification shows only "New Expensify" instead of User A's email

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/808e7ec9-6530-4145-8876-e4fd2172df16

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0105129a47d0b5f423
  • Upwork Job ID: 1787504579384856576
  • Last Price Increase: 2024-05-06
melvin-bot[bot] commented 2 weeks ago

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

lanitochka17 commented 2 weeks ago

@joekaufmanexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

lanitochka17 commented 2 weeks ago

We think that this bug might be related to #vip-vsp

gijoe0295 commented 2 weeks ago

Proposal

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

App notification shows only "New Expensify" instead of sender name when sender does not have a display name.

What is the root cause of that problem?

This is indeed a BE issue that when sender does not have a display name (or display name is the default which is equal to login), Pusher sends the action's person with empty text.

https://github.com/Expensify/App/blob/ff368b8774b98a2062328010e5e0bfcc3200e97b/src/libs/Notification/LocalNotification/BrowserNotifications.ts#L100-L101

Later the browser engine would fallback the the app name if notification's title is empty.

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

However, we could handle that in the FE by using the action's actorAccountID and find the corresponding display name using ReportUtils.getDisplayNameForParticipant:

const {person, message, actorAccountID} = reportAction;
let plainTextPerson = person?.map((f) => f.text).join() ?? '';
if (!plainTextPerson && actorAccountID) {
    plainTextPerson = ReportUtils.getDisplayNameForParticipant(actorAccountID);
}
joekaufmanexpensify commented 1 week ago

Going to review this morning

joekaufmanexpensify commented 1 week ago

This is reproducible on any platform. We're not showing the primary login in the notification if no display name is set.

joekaufmanexpensify commented 1 week ago

Made this internal based on the above comment that the fix here is BE

melvin-bot[bot] commented 1 week ago

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

melvin-bot[bot] commented 1 week ago

Triggered auto assignment to Contributor Plus for review of internal employee PR - @dukenv0307 (Internal)

joekaufmanexpensify commented 1 week ago

@dukenv0307 LMK if you agree that BE fix is needed here?

dukenv0307 commented 1 week ago

https://github.com/Expensify/App/assets/129500732/ed0129dc-3535-47c2-b1b6-3fde5bbdc426

@joekaufmanexpensify I can't reproduce

joekaufmanexpensify commented 1 week ago

Interesting. I'll try and reproduce again today

joekaufmanexpensify commented 1 week ago

Hmm yeah it's working for me now too. Perhaps it was an issue related to our site instability yesterday. Going to close for now since this seems to be resolved!