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

[HOLD for payment 2023-04-10] [HOLD for payment 2023-03-31] [$1000] Display name with white spaces are not removed #15438

Closed
2 tasks
kavimuru opened this issue Feb 23, 2023 · 60 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Feb 23, 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!


Action Performed:

  1. Open the app
  2. Navigate to Settings > Profile
  3. Click on Display Name
  4. In the First Name field enter a string separated by a bunch of spaces (eg : Daraksha Test.)
  5. Save

Expected Result:

The whitespaces between 2 words should be displayed on Web

Actual Result:

On Web the extra spaces are removed. On Android and iOS apps the extra spaces remain.

Workaround:

unknown

Platforms:

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

  • Web
  • Desktop

Version Number: 1.2.76-3
Reproducible in staging?: y
Reproducible in production?: y
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:

image

Expensify/Expensify Issue URL:
Issue reported by: @daraksha-dk
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1677157852205049
View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0127e10cabcbea08ee
  • Upwork Job ID: 1629241476360613888
  • Last Price Increase: 2023-02-24
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 23, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 23, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@sonialiap
Copy link
Contributor

sonialiap commented Feb 24, 2023

Reproducible

  1. Open the NewDot app
  2. Navigate to Settings > Profile
  3. Click on Display Name
  4. In the First Name field enter a string separated by a bunch of spaces (eg : Sonia Test.)

Outcome:

On Android the spaces will show
On Web the spaces are removed

Android:
image

image

iOS:
image

Web NewDot and OldDot:
image

image

@MelvinBot
Copy link

Triggered auto assignment to @alex-mechler (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@alex-mechler
Copy link
Contributor

Since this doesn't happen for web / olddot, its something on the front end. Marking as external

@alex-mechler alex-mechler added the External Added to denote the issue can be worked on by a contributor label Feb 24, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 24, 2023
@melvin-bot melvin-bot bot changed the title Display name with white spaces are not removed [$1000] Display name with white spaces are not removed Feb 24, 2023
@MelvinBot
Copy link

MelvinBot commented Feb 24, 2023

@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

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

Current assignee @alex-mechler is eligible for the External assigner, not assigning anyone new.

@allroundexperts
Copy link
Contributor

allroundexperts commented Feb 24, 2023

Proposal

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

Extra spaces inside display name show up on native platforms.

What is the root cause of that problem?

At the point where we're saving the name in our frontend, currently we are using values.firstName.trim(). The simple trim function only works on removing the spaces at the start or end of a string. We need to use regex here such that it removes all the whitespaces except one, between words.

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

We should trim the name properly here.
Something like this will work:

values.firstName.replace(/\s+/g, " ").trim(),
values.lastName.replace(/\s+/g, " ").trim(),

If we want to just use regex and discard trim function, something like this should work:

values.firstName.replace(/^\s+|\s+$/g, "");
values.lastName.replace(/^\s+|\s+$/g, "");

What alternative solutions did you explore? (Optional)

We can also block the user from proceeding by showing him an error. This would probably be an overkill. Silently trimming the name works best I guess.

We can do the same from line breaks as well but since this is a single line input, I don't think that is required.

@Santhosh-Sellavel
Copy link
Collaborator

We should trim the name properly here.

How can you elaborate? @allroundexperts

@allroundexperts
Copy link
Contributor

allroundexperts commented Feb 24, 2023

@Santhosh-Sellavel At the point where we're saving the name in our frontend, currently we are using values.firstName.trim(). The simple trim function only works on removing the spaces at the start or end of a string. We need to use regex here such that it removes all the whitespaces except one, between words.

@tienifr
Copy link
Contributor

tienifr commented Feb 25, 2023

Proposal

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

The whitespace collapsing behavior in display name is inconsistent across web and Android/iOS.

First I want to clarify the expected behavior of this issue. I believe we should show the display name as is rather than removing the white spaces in between. This aligns with the behaviors of popular apps like Slack, WhatsApp. They also do not apply "smart" modification to the user's name. We already have consensus on not applying "smart" modification to the user (message) input here so I think we can apply the same for display name as well.

What is the root cause of that problem?

The root cause is in the components to render the display name like here

, we're inheriting the white-space: no-wrap from parent components, so in the Web it will collapse the consequent whitespaces into 1 whitespace.

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

To fix this, we need to apply whiteSpace: whiteSpace.preWrap, (or pre) anywhere we show the display name so that the name will be shown as is without modification.
For example, to fix the display name in the message header we can add whiteSpace: whiteSpace.preWrap, (or pre) in here

chatItemMessageHeaderSender: {

What alternative solutions did you explore? (Optional)

If we want the display to align with web then we can add logic to make white-space: no-wrap work in native so that it will collapse the whitespace in native as well. Meaning we store the display name as is (without applying "smart" modification) but will display it consistently across web & native.

@tienifr
Copy link
Contributor

tienifr commented Feb 25, 2023

I attached a screenshot of how Slack handles it below for reference (WhatsApp is the same):

IMG_3906

@allroundexperts
Copy link
Contributor

allroundexperts commented Feb 25, 2023

This behaviour isn't consistent with Slack app as well. At some places, it shows the display name like @tienifr has posted. But at other places, it trims the extra whitespaces. I've attached the screenshots.

Screenshot 2023-02-25 at 8 03 32 PM

Screenshot 2023-02-25 at 8 04 17 PM

When the profile is opened by clicking your name on the top, then again it is trimming the whitespaces.
Screenshot 2023-02-25 at 8 06 09 PM

On mobile though, slack shows with whitespaces everywhere. The behaviour seems to be different on desktop and web version of Slack.

I don't think that we can compare this with WhatsApp because the former allows almost any character to be used in display name eg ~~~!a is a valid name in WhatsApp.

On Slack, using any special character in display name results in an error.

Screenshot 2023-02-25 at 8 20 30 PM

Screenshot 2023-02-25 at 8 22 05 PM

If we decide to remove the extra whitespaces, then using white-space might not be a good approach. This is because we'll have to use white-space everywhere we are displaying the name. In future, it will be highly likely that someone will miss this property and the behaviour will become inconsistent again.

@s77rt
Copy link
Contributor

s77rt commented Feb 26, 2023

Proposal

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

On web, multiple white spaces are replaced by one.

What is the root cause of that problem?

This is a bug in RNW where it applies style whiteSpace: 'nowrap' here.

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

Instead of nowrap use pre i.e. whiteSpace: 'pre'.

What alternative solutions did you explore? (Optional)

  • If we want to prevent users from having multiple white spaces in their names, we must do so in the backend.

@melvin-bot melvin-bot bot added the Overdue label Feb 27, 2023
@Santhosh-Sellavel
Copy link
Collaborator

As of now, we can clearly see the bug is on the web which doesn't show the space which should be there.

@alex-mechler I'm unsure what's the expected behavior here. Let me know your thoughts here.

@melvin-bot melvin-bot bot removed the Overdue label Feb 27, 2023
@MelvinBot
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.88-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-03-31. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

MelvinBot commented Mar 24, 2023

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:

  • [@alex-mechler] The PR that introduced the bug has been identified. Link to the PR: Last change for this was 2 years ago, when we were at the very early stages of RNC. This has likely existed well before then
  • [@alex-mechler] 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: N/a
  • [@alex-mechler] 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: https://expensify.slack.com/archives/C049HHMV9SM/p1680188592197909
  • [@sonialiap] Determine if we should create a regression test for this bug.
  • [@Santhosh-Sellavel] 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.
  • [@sonialiap] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@sobitneupane
Copy link
Contributor

#16524 is a regression caused by PR for this issue.

cc: @tienifr @Santhosh-Sellavel @alex-mechler

@Santhosh-Sellavel
Copy link
Collaborator

@alex-mechler please have a look at this when you have time.

@Santhosh-Sellavel
Copy link
Collaborator

@alex-mechler Checklist here #15438 (comment) doesn't makes sense

[@alex-mechler] The PR that introduced the bug has been identified. Link to the PR: #15646

This PR Linked is the PR for this BUG. The actual Bug here is not caused by any PR it was something upstream.

@alex-mechler
Copy link
Contributor

Oh whoops, was filling out the BZ checklist and moving a bit too fast. Thanks for the ping. Will fix it up

@melvin-bot melvin-bot bot added Daily KSv2 Weekly KSv2 and removed Weekly KSv2 Daily KSv2 labels Mar 31, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-03-31] [$1000] Display name with white spaces are not removed [HOLD for payment 2023-04-10] [HOLD for payment 2023-03-31] [$1000] Display name with white spaces are not removed Apr 3, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 3, 2023
@MelvinBot
Copy link

Reviewing label has been removed, please complete the "BugZero Checklist".

@MelvinBot
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.93-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-04-10. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot

This comment was marked as duplicate.

@alex-mechler
Copy link
Contributor

BZ checklist was here #15438 (comment), that one is probably from one of the regressions

@melvin-bot melvin-bot bot added the Overdue label Apr 17, 2023
@alex-mechler
Copy link
Contributor

@sonialiap Can you finish off the BZ checklist here, and make sure this was paid out? #15438 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Apr 17, 2023
@sonialiap
Copy link
Contributor

sonialiap commented Apr 24, 2023

My apologies for the delay in payment! I was out of office. On it now

@daraksha-dk offer sent for reporting the issue - paid
@tienifr offer sent for fixing the issue - paid
@Santhosh-Sellavel offer sent for C+ reviewing the issue (minus regression) - paid

@daraksha-dk
Copy link
Contributor

@sonialiap Sorry but I'm unable to find any offer for this issue on Upwork. Can you please re-check. Thanks!

@melvin-bot melvin-bot bot added the Overdue label May 2, 2023
@alex-mechler
Copy link
Contributor

@sonialiap Is this all paid out?

@melvin-bot melvin-bot bot removed the Overdue label May 4, 2023
@sonialiap
Copy link
Contributor

@daraksha-dk offer re-sent

This is your profile, correct?

@daraksha-dk
Copy link
Contributor

@sonialiap yes, it's mine and I've accepted the offer now. Thank you.

@sonialiap
Copy link
Contributor

@daraksha-dk paid ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

12 participants