[bbb-greenlight: 9/39] Fixed 404 on room join (#2092)
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bbb-greenlight: 9/39] Fixed 404 on room join (#2092)
- Date: Thu, 15 Oct 2020 07:11:22 +0000 (UTC)
commit 55dd5725b54f252e56d6959619a8d52a6bae196e
Author: Ahmad Farhat <ahmad af farhat gmail com>
Date: Thu Sep 17 11:32:06 2020 -0400
Fixed 404 on room join (#2092)
app/controllers/application_controller.rb | 2 +-
app/controllers/rooms_controller.rb | 8 +++-----
spec/controllers/rooms_controller_spec.rb | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 62cf742..f1de6a2 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 3cf560e..6bd35d6 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 5036fa5..d019954 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]