Fixed 404 on room join (#2092)

This commit is contained in:
Ahmad Farhat 2020-09-17 11:32:06 -04:00 committed by GitHub
parent a27884733d
commit 55dd5725b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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