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

[$500] Chat - Console error shows up when receiving message in #announce room #27447

Closed
1 of 6 tasks
lanitochka17 opened this issue Sep 14, 2023 · 13 comments
Closed
1 of 6 tasks
Assignees
Labels
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

@lanitochka17
Copy link

lanitochka17 commented Sep 14, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Issue found when executing PR #26850

Action Performed:

  1. Go to staging.new.expensify.com
  2. User A and User B stay in #announce room
  3. User B sends a message (text or attachment) to User A

Expected Result:

Console error will not show up on receiver end (User A)

Actual Result:

Console error shows up on receiver end (User A)

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • Windows / Chrome
  • MacOS / Desktop

Version Number: 1.3.70-2

Reproducible in staging?: Yes

Reproducible in production?: Yes

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6200454_20230914_220712.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0183471120ce59aad5
  • Upwork Job ID: 1702337125677191168
  • Last Price Increase: 2023-09-14
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

Triggered auto assignment to @puneetlath (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

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

@akinwale
Copy link
Contributor

akinwale commented Sep 14, 2023

Proposal

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

Console error shows up when receiving message in #announce room.

What is the root cause of that problem?

In BrowserNotifications, we try to obtain the displayName as the roomName from the report. However, #announce rooms do not have the displayName property in their corresponding report object. They only have reportName.

if (isChatRoom) {
const roomName = _.get(report, 'displayName', '');

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

Change the implementation to try to get the displayName property first, and if that doesn't exist, use the reportName property instead.

-const roomName = _.get(report, 'displayName', '');
+const roomName = _.get(report, 'displayName', _.get(report, 'reportName', ''));

or

+const roomName = _.has(report, 'displayName') ? _.get(report, 'displayName', '') : _.get(report, 'reportName', '');

We can also consider setting a default string if neither displayName nor reportName exists as a property of the report object instead of empty string. This will prevent the possibility of future console errors resulting from an empty title which is derived from the roomName const.

Alternatively, if we don't use a default string, perform an early return if the value ends up being an empty string in this scenario.

What alternative solutions did you explore? (Optional)

None.

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Sep 14, 2023
@melvin-bot melvin-bot bot changed the title Chat - Console error shows up when receiving message in #announce room [$500] Chat - Console error shows up when receiving message in #announce room Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

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

melvin-bot bot commented Sep 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

📣 @MuzanEDM! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@Pujan92
Copy link
Contributor

Pujan92 commented Sep 14, 2023

Are we passing earlier displayName for these rooms as it is only used while making this change here in this PR, if so then we need to pass displayName for these reports from backend.

@bernhardoj
Copy link
Contributor

Proposal

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

Console error and no notification received when sending a new message from another client on a chat room.

What is the root cause of that problem?

The error happens when we are constructing the title and body text of the notification. If it's a chat room, we want the title of the notification to be the room name and we get it from displayName property of a report.

if (isChatRoom) {
const roomName = _.get(report, 'displayName', '');
title = roomName;
body = `${plainTextPerson}: ${plainTextMessage}`;

However, displayName is actually a non-existent property. This issue has the same root cause as this one and the root cause is explained in this proposal.

TLDR;
displayName is previously available because we are mutating the global report object in getOrderedReportIDs by adding displayName property to it. It's not the case now, so displayName is undefined.

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

The solution is (also the same as the mentioned issue above) to use ReportUtils.getReportName(report) to get the name.

const roomName = ReportUtils.getReportName(report)

@hungvu193
Copy link
Contributor

Dupe of #23234

@puneetlath
Copy link
Contributor

Thanks @hungvu193

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 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

8 participants
@puneetlath @akinwale @Pujan92 @hungvu193 @fedirjh @bernhardoj @lanitochka17 and others