diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 0ea61536..26ab934e 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -22,7 +22,7 @@ class RoomsController < ApplicationController end end - # GET/POST /r/:room_uid + # GET /r/:room_uid def show opts = default_meeting_options @@ -34,13 +34,8 @@ class RoomsController < ApplicationController redirect_to @room.join_path(current_user, opts) end else - # If you're unauthenticated, you must enter a name to join the meeting. - if params[:join_name] - redirect_to @room.join_path(params[:join_name], opts) - else - # Render the join page so they can supply their name. - render :join - end + # Render the join page so they can supply their name. + render :join end else # If the meeting isn't running and you don't own the room, go to the waiting page. @@ -50,6 +45,16 @@ class RoomsController < ApplicationController end end + # POST /r/:room_uid + def join + opts = default_meeting_options + + # If you're unauthenticated, you must enter a name to join the meeting. + if params[:join_name] + redirect_to @room.join_path(params[:join_name], opts) + end + end + # DELETE /r/:room_uid def destroy @room.destroy diff --git a/config/routes.rb b/config/routes.rb index 01d73479..dbbb0349 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,11 @@ Rails.application.routes.draw do + # Room resources. resources :rooms, only: [:create, :show, :destroy], param: :room_uid, path: '/r' - # Room routes. + # Extended room routes. scope '/r/:room_uid' do + post '/', to: 'rooms#join' get '/start', to: 'rooms#start', as: :start_room match '/wait', to: 'rooms#wait', as: :wait_room, via: [:get, :post] get '/logout', to: 'rooms#logout', as: :logout_room