A platform for community discussion. Free, open, simple.
FIX: Support dotted usernames in voice invite links (#44088)
Penar Musaraj5362d24a1252
diff --git a/plugins/voice/config/routes.rb b/plugins/voice/config/routes.rbindex c0d7f5a80f3..e7c3f6d6068 100644--- a/plugins/voice/config/routes.rb+++ b/plugins/voice/config/routes.rb@@ -41,7 +41,11 @@ Voice::Engine.routes.draw doget "contacts" => "contacts#index"get "chat_threads/:id" => "chat_threads#show", :constraints => { id: /\d+/ }get "r/:slug" => "page#show", :format => false- get "r/:slug/invited-by/:username" => "page#show", :format => false+ get "r/:slug/invited-by/:username" => "page#show",+ :format => false,+ :constraints => {+ username: RouteFormat.username,+ }endDiscourse::Application.routes.draw dodiff --git a/plugins/voice/spec/requests/voice/page_controller_spec.rb b/plugins/voice/spec/requests/voice/page_controller_spec.rbindex 2e71ffee161..fe3cacdcc00 100644--- a/plugins/voice/spec/requests/voice/page_controller_spec.rb+++ b/plugins/voice/spec/requests/voice/page_controller_spec.rb@@ -43,6 +43,15 @@ RSpec.describe Voice::PageController doexpect(response.status).to eq(200)end+ it "renders the app shell for an invite link when the inviter's username contains a period" do+ staff.update!(username: "alice.smith")+ sign_in(user)++ get "/voice/r/#{room.slug}/invited-by/#{staff.username_lower}"++ expect(response.status).to eq(200)+ end+it "returns 404 for an unknown slug" dosign_in(user)