hotosm / galaxy-ui

This is the frontend interface for the OSM Galaxy project built using React.
5 stars 3 forks source link

Handling usernames with one character #111

Closed ramyaragupathy closed 2 years ago

ramyaragupathy commented 2 years ago

In the user report section when I input username with just single characters, I get the following error message:

image image

Can we handle this much better than having to come out of of the user report page? Like disabling the submit button or showing an error message within the user report page?

This only happens when all the input usernames have just single character. It is not an issue when such names are combined with other usernames with more than one character.

image
d-rita commented 2 years ago

Tested this out and got this. What I realised is that the single character usernames are not being added to the request sent to the API.

error

Because they don't match this regex pattern - (that checks that it is a multiple-character word), the usernames are not added: https://github.com/hotosm/galaxy-ui/blob/4498c360e92071c2ee37ec28a3b6741a5d2cdece/src/utils/formatInputs.js#L23 https://github.com/hotosm/galaxy-ui/blob/4498c360e92071c2ee37ec28a3b6741a5d2cdece/src/utils/formatInputs.js#L24

The proposed solution is to either remove the regex or alter it to fit different usernames based on what OSM permits via username restrictions.