From 543a2d70b2907d8742922b5c549c436f5ceb763c Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 29 Jul 2021 13:43:25 +0800 Subject: [PATCH] FIX: PM tags route should work for usernames with a period. --- config/routes.rb | 2 +- spec/requests/tags_controller_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 211a4ff65de..f48ad3d5ea9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -922,7 +922,7 @@ Discourse::Application.routes.draw do get '/' => 'tags#index' get '/filter/list' => 'tags#index' get '/filter/search' => 'tags#search' - get '/personal_messages/:username' => 'tags#personal_messages' + get '/personal_messages/:username' => 'tags#personal_messages', constraints: { username: RouteFormat.username } post '/upload' => 'tags#upload' get '/unused' => 'tags#list_unused' delete '/unused' => 'tags#destroy_unused' diff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rb index ea6334232d2..fecf09f2ebd 100644 --- a/spec/requests/tags_controller_spec.rb +++ b/spec/requests/tags_controller_spec.rb @@ -520,6 +520,14 @@ describe TagsController do tag = response.parsed_body['tags'] expect(tag[0]["id"]).to eq('test') end + + it 'works with usernames with a period' do + admin.update!(username: "test.test") + + get "/tags/personal_messages/#{admin.username}.json" + + expect(response.status).to eq(200) + end end end