diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 62cf742d..f1de6a20 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -235,7 +235,7 @@ class ApplicationController < ActionController::Base path = if allow_greenlight_accounts? signin_path elsif Rails.configuration.loadbalanced_configuration - omniauth_login_url(:bn_launcher) + "#{Rails.configuration.relative_url_root}/auth/bn_launcher" else signin_path end diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 3cf560e0..6bd35d6a 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -91,6 +91,7 @@ class RoomsController < ApplicationController # GET /rooms def cant_create_rooms + return redirect_to root_path unless current_user shared_rooms = current_user.shared_rooms if current_user.shared_rooms.empty? @@ -156,11 +157,8 @@ class RoomsController < ApplicationController def join_specific_room room_uid = params[:join_room][:url].split('/').last - begin - @room = Room.find_by!(uid: room_uid) - rescue ActiveRecord::RecordNotFound - return redirect_to current_user.main_room, alert: I18n.t("room.no_room.invalid_room_uid") - end + @room = Room.find_by(uid: room_uid) + return redirect_to cant_create_rooms_path, alert: I18n.t("room.no_room.invalid_room_uid") unless @room redirect_to room_path(@room) end diff --git a/spec/controllers/rooms_controller_spec.rb b/spec/controllers/rooms_controller_spec.rb index 5036fa52..d019954b 100644 --- a/spec/controllers/rooms_controller_spec.rb +++ b/spec/controllers/rooms_controller_spec.rb @@ -683,7 +683,7 @@ describe RoomsController, type: :controller do post :join_specific_room, params: { join_room: { url: "abc" } } expect(flash[:alert]).to eq(I18n.t("room.no_room.invalid_room_uid")) - expect(response).to redirect_to room_path(@user.main_room) + expect(response).to redirect_to cant_create_rooms_path end it "should redirect the user to the room uid they supplied" do