Skip to content

[$500] Android - Thread-Mention phone number on reply thread shows expensify.sms in header #39305

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

Closed
1 of 6 tasks
lanitochka17 opened this issue Mar 29, 2024 · 29 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 29, 2024

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.58
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:

  1. Launch app
  2. Tap on phone contact report
  3. Enter @ followed by phone number in compose
  4. Send the message
  5. Long press and select reply in thread

Expected Result:

@ followed by phone number should be displayed in header on selecting reply in thread

Actual Result:

@ followed by phone number should be displayed in header on selecting reply in thread but header displays @ followed by phone number.expensify.sms

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6432086_1711748341603.screenrecorder-2024-03-30-01-16-41-993.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0187f0ca34aefd2447
  • Upwork Job ID: 1775276514284834816
  • Last Price Increase: 2024-04-09
  • Automatic offers:
    • rayane-djouah | Reviewer | 0
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

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

@ahmedGaber93
Copy link
Contributor

ahmedGaber93 commented Mar 30, 2024

Proposal

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

Android - Thread-Mention phone number on reply thread shows expensify.sms in header

What is the root cause of that problem?

in getDisplayNameOrDefault when we get the user details display Name, we removeSMSDomain only in the below case.

// If the displayName is not set by the user, the backend sets the diplayName same as the login so
// we need to remove the sms domain from the displayName if it is an sms login.
if (displayName === passedPersonalDetails?.login && Str.isSMSLogin(passedPersonalDetails?.login)) {
displayName = Str.removeSMSDomain(displayName);
}

in this issue case the personalDetails for this user not have login and displayName set by backend [email protected]

{
  "accountID": 16574166,
  "avatar": "https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/default-avatar_7.png",
  "displayName": "[email protected]",
  "firstName": "",
  "lastName": ""
}

So the removeSMSDomain not applied for this case.

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

we need to update the condition here to be

// if (displayName === passedPersonalDetails?.login && Str.isSMSLogin(passedPersonalDetails?.login)) {
if (
    (displayName === passedPersonalDetails?.login && Str.isSMSLogin(passedPersonalDetails?.login)) ||
    (!passedPersonalDetails?.login && Str.isSMSLogin(displayName)) // <<<< this issue case
)

This will fix the issue in all places, Header, LHN, welcome message and profile details (if you click on the header)

What alternative solutions did you explore? (Optional)

we can also remove the condition to apply Str.removeSMSDomain in all cases like what we do in MentionUserRenderer here

// if (displayName === passedPersonalDetails?.login && Str.isSMSLogin(passedPersonalDetails?.login)) { 
     displayName = Str.removeSMSDomain(displayName); 
// } 

@nkdengineer
Copy link
Contributor

nkdengineer commented Mar 30, 2024

Proposal

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

  • Android - Thread-Mention phone number on reply thread shows expensify.sms in header

What is the root cause of that problem?

  • We get the report name from here. In case of this bug, parentReportAction.message[0].text is something like [email protected] if parent message is @+123456789

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

  • We should update the above to:
        const parentReportActionMessage = (
            ReportActionsUtils.isApprovedOrSubmittedReportAction(parentReportAction)
                ? ReportActionsUtils.getReportActionMessageText(parentReportAction)
                : Str.removeSMSDomain(parentReportAction?.message?.[0]?.text ?? '')

What alternative solutions did you explore? (Optional)

  • The main solution does not consider the case, user types "[email protected]" directly. In this case, we should not remove "@expensify.sms".

    The solution is:

  • Assume that user send a message @+123456789 What are you doing?
  • The reportAction.message will be:
{
    "html": "<mention-user>@[email protected]</mention-user> What are you doing?",
    "text": "@[email protected] What are you doing?",
    "type": "COMMENT"
}
  • We will check all the <mention-user> tags in html and remove all the sms domains. After this step, html will be:
<mention-user>@+123456789</mention-user> What are you doing?
  • Finally, we convert the above html to text, and use this text as report name instead of using parentReportAction?.message?.[0]?.text ?? '' in here, it will be:
@+123456789 What are you doing?
  • Here is the implementation of the above idea: We just need to update this to:
const parser = new ExpensiMark();
        const parentReportActionMessage = (
            ReportActionsUtils.isApprovedOrSubmittedReportAction(parentReportAction)
                ? ReportActionsUtils.getReportActionMessageText(parentReportAction)
                : parser.htmlToText(parentReportAction?.message?.[0]?.html ?? '').replace(/(<mention-user>)(.*?)(<\/mention-user>)/gi, function(match, openTag, content, closeTag) {
                    content = Str.removeSMSDomain(content);  
                    return openTag + content + closeTag;
                })
        ).replace(/(\r\n|\n|\r)/gm, ' ');

In the above:

  • <mention-user>)(.*?)(<\/mention-user> is the regex matching all the text inside mention-user tag.
  • We can consider applying this change to other positions, such as LHN, ...

@hayes102
Copy link

hayes102 commented Mar 30, 2024

I am not sure if this is actually a bug. seems like a minor issue.
cc @mountiny

Copy link

melvin-bot bot commented Mar 30, 2024

📣 @hayes102! 📣
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. Make sure you've read and understood the contributing guidelines.
  2. 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.
  3. 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.
  4. 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>

@melvin-bot melvin-bot bot added the Overdue label Apr 1, 2024
@anmurali
Copy link

anmurali commented Apr 2, 2024

Ah I think it is worth fixing cause that format +@[email protected] is internal and means nothing to the end user and could confuse them

@melvin-bot melvin-bot bot removed the Overdue label Apr 2, 2024
@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Apr 2, 2024
@melvin-bot melvin-bot bot changed the title Android - Thread-Mention phone number on reply thread shows expensify.sms in header [$500] Android - Thread-Mention phone number on reply thread shows expensify.sms in header Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0187f0ca34aefd2447

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

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

@mountiny
Copy link
Contributor

mountiny commented Apr 2, 2024

Agreed with Anu

@melvin-bot melvin-bot bot added the Overdue label Apr 5, 2024
@rayane-d
Copy link
Contributor

rayane-d commented Apr 6, 2024

Reviewing proposals...

@melvin-bot melvin-bot bot removed the Overdue label Apr 6, 2024
@rayane-d
Copy link
Contributor

rayane-d commented Apr 8, 2024

@ahmedGaber93 The root cause in your proposal is incorrect; we don't use PersonalDetailsUtils.getDisplayNameOrDefault when determining a report's name. I also tried your suggested changes, but they didn't fix the bug.

@rayane-d
Copy link
Contributor

rayane-d commented Apr 8, 2024

@nkdengineer, you've identified the correct root cause in your proposal and suggested changing LGTM.
It uses the same approach as we are doing with the last message text in LHN subtitles here.
I prefer your main solution over the alternative, as currently, when the user types @[email protected] directly in a message, we remove the @expensify.com part, as shown in the video below. Additionally, the intention in this issue is to hide the format @expensify.sms in UI everywhere as it is internal.

Recording.2024-04-08.142713.mp4

@nkdengineer's proposal LGTM!
🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 8, 2024

Triggered auto assignment to @thienlnam, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Apr 9, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 9, 2024
Copy link

melvin-bot bot commented Apr 9, 2024

📣 @rayane-djouah 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Apr 9, 2024

📣 @nkdengineer You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@rayane-d
Copy link
Contributor

rayane-d commented Apr 9, 2024

@nkdengineer please let us know your ETA

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 10, 2024
@nkdengineer
Copy link
Contributor

@rayane-djouah PR #39994 is ready to review

@rayane-d
Copy link
Contributor

rayane-d commented Apr 10, 2024

@nkdengineer we agreed on the main solution in your proposal #39305 (comment), didn't we? I see that the PR is implementing the alternative one.

@nkdengineer
Copy link
Contributor

As I mentioned in the PR, we need to consider the case: User sends message "test message [email protected]" directly, If we apply the main solution, it will be "test message +123456789". But I think the expected is "test message [email protected]"

@rayane-d
Copy link
Contributor

rayane-d commented Apr 10, 2024

@anmurali, @thienlnam, we need clarification about the expected result when the user sends a message that contains "@expensify.sms" (not necessarily a mention); as seen in the screenshot below, currently, we remove all "@expensify.sms" occurrences on the message when displaying the last message of the report in the LHN subtitle.

image

In this issue, should we:

  1. Follow the same approach used in LHN subtitles and remove any "@expensify.sms" occurrences when displaying the message in the thread header.
  2. Remove it only from mentions. In this case, do we need to change the logic of LHN subtitles to follow the same approach for consistency?

@rayane-d
Copy link
Contributor

Asked in Slack

@rayane-d
Copy link
Contributor

@nkdengineer, we got an answer in Slack; we should implement your main solution.

@rayane-d
Copy link
Contributor

Deployed to production #39994 (comment)

@rayane-d
Copy link
Contributor

@anmurali, please remove the Reviewing label and bump to Daily as payment is due

@rayane-d
Copy link
Contributor

rayane-d commented May 3, 2024

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:

  • The PR that introduced the bug has been identified. Link to the PR: Fix - Remove @expensify.sms from SMS mentions #37559
  • 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: Fix - Remove @expensify.sms from SMS mentions #37559 (comment)
  • 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: N.A.
  • Determine if we should create a regression test for this bug. Yes.
  • 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.

Regression test proposal

We should update this tests to include:

  1. Go to any room and type @
  2. Select a user with phone number login
  3. Send the message
  4. Long press and select reply in thread
  5. Verify that @ followed by phone number (eg: @+123456789) should be displayed in thread header without an @expensify.sms suffix.
  • Do we agree 👍 or 👎

@rayane-d
Copy link
Contributor

rayane-d commented May 3, 2024

@anmurali friendly bump for payment

@anmurali
Copy link

anmurali commented May 7, 2024

Done!

@anmurali anmurali closed this as completed May 7, 2024
@nkdengineer
Copy link
Contributor

Sorry @anmurali It seems I wasn't paid here, could you please reopen the issue to help with this?

TIA

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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants