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

Any whitespace should be trimmed from these places to avoid bugs #4155

Closed
aman-atg opened this issue Jul 20, 2021 · 18 comments
Closed

Any whitespace should be trimmed from these places to avoid bugs #4155

aman-atg opened this issue Jul 20, 2021 · 18 comments
Assignees
Labels
Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@aman-atg
Copy link
Contributor

aman-atg commented Jul 20, 2021

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:

Places where extra whitespace is causing trouble :-

Search Page

  1. search for an email
  2. add extra space
  3. result will disappear

image

Profile Page

  1. Go to profile Page
  2. Edit Firstname and Lastname
  3. Add extra space
  4. Save
  5. Input will be saved as it is. (without trimming the space)

image

Emoji Picker

  1. Login to E.cash
  2. Open any chat
  3. Click the emoji picker
  4. Search for an emoji and add whitespace before or after the search term (Eg. thinking )

Expected Result:

image

Actual Result:

image

Workaround:

Remove whitespace manually

Platform:

Where is this issue occurring?

Web ✔️
iOS ✔️
Android ✔️
Desktop App ✔️
Mobile Web ✔️

Version Number:
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:

View all open jobs on Upwork

@aman-atg aman-atg added the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 20, 2021
@MelvinBot
Copy link

Triggered auto assignment to @trjExpensify (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 20, 2021
@aman-atg
Copy link
Contributor Author

Proposal :

Inside, src/pages/home/report/EmojiPickerMenu/index.js on line 277

the line :- const normalizedSearchTerm = searchTerm.toLowerCase(); can be changed to
const normalizedSearchTerm = searchTerm.toLowerCase().trim();
which will take care of all the whitespaces.

@aman-atg
Copy link
Contributor Author

This proposal can fix #4156 as well

@rushatgabhane
Copy link
Member

@aman-atg I think it'll be a good idea do an audit, and fix it in a combined issue.

@aman-atg
Copy link
Contributor Author

@rushatgabhane Agreed, I'll see where else this issue is occurring and update #4155.

@aman-atg aman-atg changed the title Any whitespace should be removed while searching for emojies Any whitespace should be trimmed from these places to avoid bugs Jul 21, 2021
@aman-atg
Copy link
Contributor Author

aman-atg commented Jul 21, 2021

Updated Proposal :

For Search Page

this.state.searchValue,

  • should be changed to
  this.state.searchValue.trim(),

For Profile Page

const isButtonDisabled = (this.props.myPersonalDetails.firstName === this.state.firstName)
&& (this.props.myPersonalDetails.lastName === this.state.lastName)

  • We can prevent this problem from occurring if isButtonDisabled remains false when only whitespaces are added to either name
  • So, it should be changed into
         const isButtonDisabled = (this.props.myPersonalDetails.firstName === this.state.firstName.trim())
         && (this.props.myPersonalDetails.lastName === this.state.lastName.trim())  

Finally for Emoji Picker

const normalizedSearchTerm = searchTerm.toLowerCase();

  • change this to
        const normalizedSearchTerm = searchTerm.toLowerCase().trim();

@MelvinBot
Copy link

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

@trjExpensify
Copy link
Contributor

I like the idea of an audit and combined issue to clean this up! Assigning to Engineering for review. 👍

@trjExpensify trjExpensify removed their assignment Jul 22, 2021
@johnmlee101
Copy link
Contributor

Yeah seems like .trim() will be needed in a lot of places! @aman-atg feel free to take this over!

@johnmlee101 johnmlee101 added the External Added to denote the issue can be worked on by a contributor label Jul 22, 2021
@MelvinBot
Copy link

Triggered auto assignment to @marklouisdeshaun (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@marklouisdeshaun
Copy link
Contributor

Upwork job post

cc: @aman-atg

@marklouisdeshaun marklouisdeshaun added Exported Help Wanted Apply this label when an issue is open to proposals by contributors labels Jul 22, 2021
@shanto-datta
Copy link

Proposal:
To me, trimming the input with .trim() felt right. Or else I would like to use reg expressions to remove white spaces from the input.

@aman-atg
Copy link
Contributor Author

Hi @marklouisdeshaun, I've submitted the proposal on upwork.

@marklouisdeshaun marklouisdeshaun removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 23, 2021
@MelvinBot
Copy link

@johnmlee101, @aman-atg, @marklouisdeshaun Whoops! This issue is 2 days overdue. Let's get this updated quick!

@johnmlee101
Copy link
Contributor

Just merged the PR

@marklouisdeshaun
Copy link
Contributor

Not overdue

@MelvinBot MelvinBot removed the Overdue label Jul 30, 2021
@marklouisdeshaun
Copy link
Contributor

PR merged

@marklouisdeshaun
Copy link
Contributor

Contributor has been paid, the contract has been completed, and the Upwork post has been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

7 participants