Add constraints to remove dots from username. (#4255)

Rails is using dots as a separator for formatted routes. As a result
if the username has more than one dot it will not match the route.

Bug raised here -> https://meta.discourse.org/t/refreshing-a-users-detail-page-in-admin-doesnt-work-in-some-cases/44891
This commit is contained in:
zachGlasgow 2016-06-09 08:52:42 +01:00 committed by Régis Hanol
parent f53494f102
commit 42ec8a7c3d

View file

@ -115,7 +115,7 @@ Discourse::Application.routes.draw do
post "reset_bounce_score"
end
get "users/:id.json" => 'users#show', defaults: {format: 'json'}
get 'users/:id/:username' => 'users#show'
get 'users/:id/:username' => 'users#show', constraints: {username: USERNAME_ROUTE_FORMAT}
get 'users/:id/:username/badges' => 'users#show'