Closed Bug 1306087 Opened 8 years ago Closed 8 years ago

I can't update my StackOverflow profile

Categories

(developer.mozilla.org Graveyard :: Profiles, enhancement)

All
Other
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: devconcept, Assigned: mveritym, Mentored)

Details

(Keywords: in-triage, Whiteboard: [specification][type:bug])

What did you do?
================
1. Tried to update my profile https://developer.mozilla.org/es/profiles/devconcept/edit
2. Updated Name, Language, Timezone and some tags
2. Typed http://es.stackoverflow.com/users/2224/devconcept in the StackOverflow field
3. Pressed submit

What happened?
==============
Received error 

"Introduce una URL de Stack Overflow válida"

What should have happened?
==========================
The link to my profile is valid. It should not throw any validation errors

Is there anything else we should know?
======================================
Stack Overflow in Spanish is already public and some users prefer to write in their native language, in my case Spanish, so it would be nice if I could link to mi SO Spanish profile instead. I have an English profile but I rarely use it.
This is the first I've learned of es.stackoverflow.com, and our URL validator assumes the English site:

https://github.com/mozilla/kuma/blob/master/kuma/users/models.py#L112-L115

devconcept, do you know if there is a list of these non-English SO sites?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(devconcept)
Severity: normal → enhancement
Keywords: in-triage
After 5 minutes of research, I couldn't find an authoritative list, so I asked:

http://meta.stackexchange.com/questions/13676/do-posts-have-to-be-in-english-on-stack-exchange

I can see it both ways on supporting this feature. On the one hand, a user's profile on StackOverflow demonstrates their programming competence and community efforts, and the Spanish StackOverflow site includes their ability to write technical answers in Spanish.  On the other hand, we don't want to encourage new content in non-English languages, only translations of the primary English content.

atopal: is there a yes / no product decision to be made?
Flags: needinfo?(devconcept) → needinfo?(a.topal)
Hi John. I am aware that is not correct to add more content than the current english source. My goal is to translate the actual content to spanish because, honestly, the quality is poor. I can also contribute in english and, if the changes are accepted, also translate the new added content. Stackoverflow does have a list of sites, you can find it here https://stackexchange.com/sites. Not all those sites are about programming but the ones in the format <lang>.stackoverflow.com are.
I agree with your reasoning, devconcept.

In comment 2, I posted the wrong link to my question:

http://meta.stackexchange.com/questions/285512/is-there-a-list-of-stackoverflow-com-locale-variants

I'd prefer an explicit regex, but the "any two characters" regex is the simplest one that could work:

^https?://(..\.)?stackoverflow\.com/users/

Since the impact is probably low, it's hard to justify staff time, but this seems like a good bug for our volunteer contributors, so I'm marking myself as mentor.

Spec:
- Allow English, Spanish, and other current "localized" StackOverflow variants
- Don't allow meta.stackoverflow.com
- Confirm validation with unit tests
Mentor: jwhitlock
Flags: needinfo?(a.topal)
Reading the link you posted in comment 4 I must add that this regex should work better

r'^https?://([a-z]{2}\.)?stackoverflow\.com/users/(\d+)'

User profiles have a number captured in the last parentheses and also the localization should contain only letters. Using a dot, like the proposed version, will allow the following string(and similar) as valid

https://__.stackoverflow.com/users

Also the usual SO user profile url "should" contain a name at the end so this version is more reliable and it is an exact match(^$)

r'^https?://(?:([a-z]{2})\.)?stackoverflow\.com/users/(\d+)(?:/([a-z]+))?$'

Capturing parentheses are site localization(if any), user id and username in groups 1, 2 and 3 respectively. The restriction of only two letters should prevent from matching meta sites (usually in the format "meta" and "meta.<locale>") and you should use the re.IGNORECASE flag when executing the regex.

I don't know Python but a quick look at the documentation(https://docs.python.org/2/library/re.html) set me in the right direction.

I don't know how else I can contribute. Could you point me in the right direction?
Hi, I'm a dev trying to get into open source, I've done Python before but not for a little while. Since this is marked as a mentored bug and it looks like no one's working on it, can I pick this up? Thanks.
Flags: needinfo?(jwhitlock)
Yes, take a look and see if you can submit a fix. You should also take a look at our contributing guide and the dev environment install instructions:

- https://github.com/mozilla/kuma/blob/master/CONTRIBUTING.md
- https://kuma.readthedocs.io/en/latest/installation.html
Assignee: nobody → mveritym
Flags: needinfo?(jwhitlock)
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/c060d3bbadcd25d5aadce4ae220638caa581aced
fix bug 1306087 - changing stackoverflow profile link regex to accept two-letter region domains

https://github.com/mozilla/kuma/commit/76c1f97226dfb96df09be441d35d26130d543479
Merge pull request #4064 from mveritym/new-issue-1306087

fix bug 1306087 - Update stackoverflow profile with regional domain
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
This fix is pushed to stage and production, and now http://es.stackoverflow.com/users/2224/devconcept is a valid value for a StackOverflow URL. Thanks, devconcept and mveritym!
Catching up on bugmail after some vacation. Happy to see this fix in production. Now I can update my linked in URL :)
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.