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 2022-01-19] When setting a custom pronoun that is over the character limit, the API throws an error but the user isn't informed - Reported by: @anthony-hull #6492

Closed
isagoico opened this issue Nov 25, 2021 · 47 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@isagoico
Copy link

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. Navigate to Profile settings
  2. On the pronouns dropdown select "Self Select"
  3. Enter a really long pronoun >50 characters
  4. Press save

Expected Result:

There's an error letting the user know that the pronouns should be under a certain amount of characters.

Actual Result:

Nothing happens, changes are not saved and no error is displayed.

Workaround:

N/A

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.16-9

Reproducible in staging?: Yes
Reproducible in production?: Yes

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

Notes/Photos/Videos: Any additional supporting documentation

New.Expensify.1.mp4

Expensify/Expensify Issue URL:

Issue reported by: @anthony-hull
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1637837622005000

View all open jobs on GitHub

@MelvinBot
Copy link

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

@kakajann
Copy link
Contributor

Proposal

  1. Add pronounsLength after lastNameLength (EN and ES)

    App/src/languages/en.js

    Lines 396 to 401 in d0d1d58

    personalDetails: {
    error: {
    firstNameLength: 'First name shouldn\'t be longer than 50 characters',
    lastNameLength: 'Last name shouldn\'t be longer than 50 characters',
    },
    },
pronounsLength: 'Pronouns shouldn\'t be longer than 50 characters',
  1. Create a new condition after this
    } else if (response.jsonCode === 401) {
    Growl.error(Localize.translateLocal('personalDetails.error.lastNameLength'), 3000);
    }

    The condition should be:
else if (response.jsonCode === 666) {
    Growl.error(Localize.translateLocal('personalDetails.error.pronounsLength'), 3000);
}

Result

Screen.Recording.2021-11-26.at.5.22.05.AM.mov

@anthony-hull
Copy link
Contributor

anthony-hull commented Nov 26, 2021

Should we even attempt the API call if we know it will fail?
Maybe we should consider doing a check for character length client side and putting a contextual error on the input?
We could also lock the save button until the error state is resolved.

@anthony-hull
Copy link
Contributor

or even better use:
https://reactnative.dev/docs/textinput#maxlength on the input element to stop flickering when user tries to exceed the limit.

@iwiznia iwiznia removed their assignment Nov 26, 2021
@iwiznia iwiznia added Weekly KSv2 Daily KSv2 External Added to denote the issue can be worked on by a contributor and removed Daily KSv2 labels Nov 26, 2021
@MelvinBot
Copy link

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

@MelvinBot MelvinBot removed the Weekly KSv2 label Nov 26, 2021
@iwiznia iwiznia added Weekly KSv2 and removed Daily KSv2 labels Nov 26, 2021
@kakajann
Copy link
Contributor

Yes we can use maxLength for the input, alongside the API response error handling

Or we can add pronouns validation to this function

validateInputs() {
const {firstNameError, lastNameError} = PersonalDetails.getFirstAndLastNameErrors(this.state.firstName, this.state.lastName);
this.setState({
firstNameError,
lastNameError,
});
return _.isEmpty(firstNameError) && _.isEmpty(lastNameError);
}

it will be something like this:

const {pronounceError} = PersonalDetails.getPronounsError(this.state.hasSelfSelectedPronouns, this.state.pronouns);

this.setState({
    firstNameError,
    lastNameError,
    pronounceError,
});

Screen Shot 2021-11-26 at 10 56 10 PM

@anthony-hull
Copy link
Contributor

Reading into it more I think it's bad practice to limit the text with maxLength, you don't want to interrupt the user mid flow. Let them get it all down and then fix the limit after. Putting it into the validate function and putting the error into the input context like above is probably best.

I'm still not convinced it's worth putting in error handling logic from the API for a state the user shouldn't be able to get to once there it client side validation. You shouldn't be allowed to submit the form if it fails validation.

I'd like to work on this issue. I think your suggested approach is a good one, I would do the same, copying the implementation of the first and last name validation and errors.

@kadiealexander
Copy link
Contributor

Upwork job here: https://www.upwork.com/jobs/~0179b0bb6fe5bcfda3

@MelvinBot
Copy link

Triggered auto assignment to @parasharrajat (Exported)

@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 29, 2021
@MelvinBot
Copy link

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

@kadiealexander
Copy link
Contributor

kadiealexander commented Nov 29, 2021

@Julesssss and @parasharrajat, would you guys mind please reviewing @anthony-hull's proposal above? :)

@parasharrajat
Copy link
Member

parasharrajat commented Nov 29, 2021

I don't see any formal proposal(exact approach) from @anthony-hull. I liked @kakajann #6492 (comment) and he posted first. I also think we won't need API checks after putting in this code. @anthony-hull If you can think of a better approach then I would like to hear about it as you raised the issue.

🎀 👀 🎀

@anthony-hull
Copy link
Contributor

sure I'm working on this today and tomorrow.
Apologies I had some down time after a vaccine.

@kadiealexander
Copy link
Contributor

No worries, thanks for the update! I hope you're feeling better.

@kadiealexander kadiealexander removed their assignment Dec 22, 2021
@kadiealexander kadiealexander added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Dec 22, 2021
@MelvinBot
Copy link

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

@MelvinBot MelvinBot added Daily KSv2 and removed Weekly KSv2 labels Dec 22, 2021
@kadiealexander
Copy link
Contributor

Reassigning this as I'm ooo until 10th Jan, thanks @bfitzexpensify!!

@anthony-hull
Copy link
Contributor

have a great break!

@bfitzexpensify bfitzexpensify added Weekly KSv2 and removed Daily KSv2 labels Dec 23, 2021
@parasharrajat
Copy link
Member

@anthony-hull When can we expect the PR for this issue?

@anthony-hull
Copy link
Contributor

I will finish the PR tomorrow. I just finished the first pass of coding the change.
Please could I have a translation of:
Exceeds the max length of ${limit} characters

@iwiznia
Copy link
Contributor

iwiznia commented Dec 24, 2021

Supera el límite de ${limit} caracteres

@bfitzexpensify
Copy link
Contributor

Progress being made in #6899, Melv

@MelvinBot MelvinBot removed the Overdue label Jan 3, 2022
@anthony-hull
Copy link
Contributor

this should be merging today 🤞

@anthony-hull
Copy link
Contributor

anthony-hull commented Jan 7, 2022

has been approved, waiting for it to merge

@botify botify added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 12, 2022
@botify
Copy link

botify commented Jan 12, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.27-1 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 2022-01-19. 🎊

@botify botify changed the title When setting a custom pronoun that is over the character limit, the API throws an error but the user isn't informed - Reported by: @anthony-hull [HOLD for payment 2022-01-19] When setting a custom pronoun that is over the character limit, the API throws an error but the user isn't informed - Reported by: @anthony-hull Jan 12, 2022
@bfitzexpensify
Copy link
Contributor

No regressions — @anthony-hull, ended the contract and paid you $500 (for reporting + fix). Thanks!

@parasharrajat, sent you an offer here for C+ review.

@bfitzexpensify
Copy link
Contributor

All wrapped up.

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

10 participants