Public room - Self DM in LHN shows @expensify.anon when visiting public room anonymously
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: 1.4.67-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: N/A Issue reported by: Applause - Internal Team
Action Performed:
- Go to staging.new.expensify.com
- Log out if logged in.
- Navigate to public room anonymously (https://staging.new.expensify.com/r/2376199970894587 ).
Expected Result:
Self DM in LHN will not show [email protected]. It should be replaced by "You" or better choice of word
Actual Result:
Self DM in LHN shows [email protected] when visiting public room anonymously.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/632e1ccf-dd54-4f61-8576-0525bfcd7f7b
Triggered auto assignment to @garrettmknight (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.
@garrettmknight 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
We think that this bug might be related to #vip-vsp
Proposal
Please re-state the problem that we are trying to solve in this issue.
The self DM in LHN as anonymous user title show an email with @expensify.anon domain.
What is the root cause of that problem?
When we logged in as anonymous user, the email is random with a @expensify.anon domain.
The LHN title for self DM shows the user display name (the email in this case) with (you) as the postfix. https://github.com/Expensify/App/blob/223672b8b70d7d57d6bd4ab6baaa4ec6e61726c7/src/libs/ReportUtils.ts#L3115-L3117
The self DM is added from the OpenApp request.
What changes do you think we should make in order to solve the problem?
I think I prefer to fix it on the BE so the OpenApp won't return a self DM report, or maybe the BE shouldn't auto create a self DM if it's an anon user, but in case we want to do something on the FE, we can hide self DM from LHN if it's an anonymous user. We can do it in a different way.
We can move this condition https://github.com/Expensify/App/blob/223672b8b70d7d57d6bd4ab6baaa4ec6e61726c7/src/libs/ReportUtils.ts#L4979-L4981 below this https://github.com/Expensify/App/blob/223672b8b70d7d57d6bd4ab6baaa4ec6e61726c7/src/libs/ReportUtils.ts#L4913-L4916
so we can control whether to include the self DM or not with the includeSelfDM param. ReportUtils has a global isAnonymousUser variable that we can use, but I prefer to pass it from the param.
https://github.com/Expensify/App/blob/223672b8b70d7d57d6bd4ab6baaa4ec6e61726c7/src/libs/SidebarUtils.ts#L110
includeSelfDM: !isAnonymousUser,
Then pass isAnonymousUser to getOrderedReportIDs here
https://github.com/Expensify/App/blob/223672b8b70d7d57d6bd4ab6baaa4ec6e61726c7/src/hooks/useReportIDs.tsx#L133-L143
const session = useSession();
...
isAnonymousUser(session),
What alternative solutions did you explore? (Optional)
We can add the anonymous and self DM check in canAccessReport so the report screen will show not found page when we access it directly from the browser address bar or deep link.
https://github.com/Expensify/App/blob/223672b8b70d7d57d6bd4ab6baaa4ec6e61726c7/src/libs/ReportUtils.ts#L4793-L4804
Thanks @bernhardoj - I'll take this up internally to figure out which way we want to go.
https://expensify.slack.com/archives/C066HJM2CAZ/p1714384363815759
Job added to Upwork: https://www.upwork.com/jobs/~0170d176396181cba4
Triggered auto assignment to Contributor Plus for review of internal employee PR - @jjcoffee (Internal)
Setting as internal for the moment, but I will flip it to External if we go FE.
Found another one handling this: https://github.com/Expensify/App/issues/41180