forked from External/greenlight
sessions and fixes
This commit is contained in:
@ -1,9 +1,16 @@
|
||||
class MainController < ApplicationController
|
||||
|
||||
before_action :redirect_to_room
|
||||
|
||||
# GET /
|
||||
def index
|
||||
@meeting = Meeting.new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def redirect_to_room
|
||||
# If the user is logged in already, move them along to their room.
|
||||
redirect_to room_path(current_user.room.uid) if current_user
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,14 +1,46 @@
|
||||
class MeetingsController < ApplicationController
|
||||
|
||||
#before_action :verify_room_ownership
|
||||
# GET /m/:meeting_uid
|
||||
def show
|
||||
@meeting = Meeting.find_by(uid: params[:meeting_uid])
|
||||
if @meeting
|
||||
|
||||
else
|
||||
# Handle meeting doesn't exist.
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# GET /r/:room_uid/meetings
|
||||
def index
|
||||
# POST /m/:meeting_uid
|
||||
def join
|
||||
meeting = Meeting.find_by(uid: params[:meeting_uid])
|
||||
if meeting
|
||||
# If the user is logged in, join using their authenticated name.
|
||||
if current_user
|
||||
redirect_to meeting.join_path(current_user.name)
|
||||
# Otherwise, use their inputed join name.
|
||||
elsif params[:join_name]
|
||||
redirect_to meeting.join_path(params[:join_name])
|
||||
end
|
||||
else
|
||||
# Handle meeting doesn't exist.
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# POST /m
|
||||
def create
|
||||
meeting = Meeting.new(meeting_params)
|
||||
if meeting.save
|
||||
redirect_to meeting_path(meeting_uid: meeting.uid)
|
||||
else
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
#def meeting_params(room)
|
||||
# params.require(:meeting).permit(:name).merge!(room: room)
|
||||
#end
|
||||
def meeting_params
|
||||
params.require(:meeting).permit(:name)
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
class RoomsController < ApplicationController
|
||||
|
||||
before_action :find_room, :verify_room_ownership
|
||||
skip_before_action :verify_room_ownership, only: [:index, :join, :wait]
|
||||
skip_before_action :verify_room_ownership, only: [:show, :join, :wait]
|
||||
|
||||
# GET /r/:room_uid
|
||||
def index
|
||||
@ -82,6 +82,10 @@ class RoomsController < ApplicationController
|
||||
redirect_to room_path(@room.uid)
|
||||
end
|
||||
|
||||
# GET /r/:room_uid/sessions
|
||||
def sessions
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Find the room from the uid.
|
||||
@ -111,4 +115,4 @@ class RoomsController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user