GRN2-xx: Fixed issue with room join (#779)

* Fixed issue with room join

* Rspec fix
This commit is contained in:
Ahmad Farhat 2019-09-05 15:50:19 -04:00 committed by Jesus Federico
parent 201a394813
commit 061b69f962
3 changed files with 21 additions and 0 deletions

View File

@ -72,6 +72,8 @@ class RoomsController < ApplicationController
render :cant_create_rooms
end
else
return redirect_to root_path, flash: { alert: I18n.t("room.invalid_provider") } if incorrect_user_domain
# Get users name
@name = if current_user
current_user.name
@ -356,4 +358,8 @@ class RoomsController < ApplicationController
render :wait
end
end
def incorrect_user_domain
Rails.configuration.loadbalanced_configuration && @room.owner.provider != @user_domain
end
end

View File

@ -412,6 +412,7 @@ en:
create_room_error: There was an error creating the room
create_room_success: Room created successfully
enter_the_access_code: Enter the room's access code
invalid_provider: You have entered an invalid url. Please check the url and try again.
invited: You have been invited to join
invite_participants: Invite Participants
join: Join

View File

@ -121,6 +121,20 @@ describe RoomsController, type: :controller do
expect(response).to redirect_to(admins_path)
end
it "redirects to root if the providers dont match" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow_any_instance_of(Room).to receive(:running?).and_return(false)
@owner.update_attribute(:provider, "provider1")
@user.update_attribute(:provider, "provider2")
@request.session[:user_id] = @user.id
get :show, params: { room_uid: @owner.main_room }
expect(flash[:alert]).to be_present
expect(response).to redirect_to(root_path)
end
end
describe "POST #create" do