forked from External/greenlight
Fixed 404 on room join (#2092)
This commit is contained in:
parent
a27884733d
commit
55dd5725b5
|
@ -235,7 +235,7 @@ class ApplicationController < ActionController::Base
|
||||||
path = if allow_greenlight_accounts?
|
path = if allow_greenlight_accounts?
|
||||||
signin_path
|
signin_path
|
||||||
elsif Rails.configuration.loadbalanced_configuration
|
elsif Rails.configuration.loadbalanced_configuration
|
||||||
omniauth_login_url(:bn_launcher)
|
"#{Rails.configuration.relative_url_root}/auth/bn_launcher"
|
||||||
else
|
else
|
||||||
signin_path
|
signin_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,6 +91,7 @@ class RoomsController < ApplicationController
|
||||||
|
|
||||||
# GET /rooms
|
# GET /rooms
|
||||||
def cant_create_rooms
|
def cant_create_rooms
|
||||||
|
return redirect_to root_path unless current_user
|
||||||
shared_rooms = current_user.shared_rooms
|
shared_rooms = current_user.shared_rooms
|
||||||
|
|
||||||
if current_user.shared_rooms.empty?
|
if current_user.shared_rooms.empty?
|
||||||
|
@ -156,11 +157,8 @@ class RoomsController < ApplicationController
|
||||||
def join_specific_room
|
def join_specific_room
|
||||||
room_uid = params[:join_room][:url].split('/').last
|
room_uid = params[:join_room][:url].split('/').last
|
||||||
|
|
||||||
begin
|
@room = Room.find_by(uid: room_uid)
|
||||||
@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
|
||||||
rescue ActiveRecord::RecordNotFound
|
|
||||||
return redirect_to current_user.main_room, alert: I18n.t("room.no_room.invalid_room_uid")
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to room_path(@room)
|
redirect_to room_path(@room)
|
||||||
end
|
end
|
||||||
|
|
|
@ -683,7 +683,7 @@ describe RoomsController, type: :controller do
|
||||||
post :join_specific_room, params: { join_room: { url: "abc" } }
|
post :join_specific_room, params: { join_room: { url: "abc" } }
|
||||||
|
|
||||||
expect(flash[:alert]).to eq(I18n.t("room.no_room.invalid_room_uid"))
|
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
|
end
|
||||||
|
|
||||||
it "should redirect the user to the room uid they supplied" do
|
it "should redirect the user to the room uid they supplied" do
|
||||||
|
|
Loading…
Reference in New Issue