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

/country/add: prohibit repeated special characters #403

Closed
php-coder opened this issue Jul 11, 2016 · 7 comments
Closed

/country/add: prohibit repeated special characters #403

php-coder opened this issue Jul 11, 2016 · 7 comments
Assignees
Milestone

Comments

@php-coder
Copy link
Owner

php-coder commented Jul 11, 2016

Currently user can specify name with multiple spaces inside, for example test test. We should disallow it (probably just replacing them by one) and also add migration for that.

When user specifies the names of country during its creation, we should validate these names and prohibit the repetition of the hyphen (for example: te--st). Also we should add the converter that will replace two and more spaces into single.

Note that we should apply this conversion/validation to the both fields.

What should be done:

  • Add integration tests
  • Add validation (@Pattern will be helpful)
@php-coder php-coder changed the title Category/country/user: don't allow multiple spaces Category/country/user: transform multiple spaces into single Jul 25, 2016
@php-coder php-coder added this to the next milestone Jul 29, 2016
@php-coder
Copy link
Owner Author

This also relates to #442, #443 and #444 because each space gets replaces by hyphen and name looks different while their slug is the same. For example, a test != a test but they have the same slug a-test.

@php-coder php-coder self-assigned this Aug 17, 2016
@php-coder php-coder modified the milestones: 0.4, next Aug 17, 2016
@php-coder php-coder removed the trivial label Aug 17, 2016
@php-coder php-coder changed the title Category/country/user: transform multiple spaces into single Category/country/user: transform multiple spaces and hyphens into single Aug 17, 2016
@php-coder
Copy link
Owner Author

php-coder commented Aug 17, 2016

We should transform multiple hyphens and underscores too.

@php-coder
Copy link
Owner Author

php-coder commented Aug 23, 2016

When we talked about replacing multiple spaces it sounded ok, but when we decided to replace hyphens and underscores too, it has changed the situation. Such implicitly behavior can puzzle user, especially with login field: user wishes to use foo__bar login, submitted the form but we modified the login to foo_bar. Now user tries to sign in with the login foo__bar and of course it wouldn't work.

To make the user experience more transparent let's add validation for it: show an error when field contains repeatable characters.

@php-coder
Copy link
Owner Author

and also add migration for that.

No-no-no. We can't do that because it will broke existing logins and also change URLs of some categories/countries (and they start to return 404 instead of do a redirection).

@php-coder php-coder changed the title Category/country/user: transform multiple spaces and hyphens into single Category/country: transform multiple spaces and hyphens into single Aug 24, 2016
@php-coder
Copy link
Owner Author

We'll improve validation of login field in #454

@php-coder
Copy link
Owner Author

We'll improve validation of category's names in #465

@php-coder php-coder changed the title Category/country: transform multiple spaces and hyphens into single /country/add: prohibit repeated special characters Aug 26, 2016
@php-coder
Copy link
Owner Author

@bodom91 This should be solved after #465 (if it's possible I would like to re-use converter for "compressing" spaces).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants