diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 49206568..d7b8b301 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -1,20 +1,20 @@ class RoomsController < ApplicationController before_action :find_room, except: :create - before_action :verify_room_ownership, only: [:start, :destroy, :home] + before_action :verify_room_ownership, except: [:create, :show, :join, :logout] META_LISTED = "gl-listed" # POST /r def create - room = Room.new(name: room_params[:name]) - room.owner = current_user + @room = Room.new(name: room_params[:name]) + @room.owner = current_user - if room.save + if @room.save if room_params[:auto_join] == "1" - redirect_to start_room_path(room) + start else - redirect_to room + redirect_to @room end else # Handle room didn't save. @@ -28,7 +28,6 @@ class RoomsController < ApplicationController @recordings = @room.recordings @is_running = @room.is_running? else - @recordings = @room.public_recordings render :join end end @@ -38,9 +37,9 @@ class RoomsController < ApplicationController opts = default_meeting_options # Assign join name if passed. - if params[@room.invite_path][:join_name] + if params[@room.invite_path] @join_name = params[@room.invite_path][:join_name] - else + elsif !params[:join_name] # Join name not passed. return end @@ -49,7 +48,7 @@ class RoomsController < ApplicationController if current_user redirect_to @room.join_path(current_user.name, opts, current_user.uid) else - join_name = params[@room.invite_path][:join_name] + join_name = params[:join_name] || params[@room.invite_path][:join_name] redirect_to @room.join_path(join_name, opts) end else @@ -152,7 +151,7 @@ class RoomsController < ApplicationController def bring_to_room if current_user # Redirect authenticated users to their room. - redirect_to room_path(current_user.room.uid) + redirect_to room_path(current_user.room) else # Redirect unauthenticated users to root. redirect_to root_path diff --git a/app/models/user.rb b/app/models/user.rb index a4c5c5e2..c0ee362f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -77,13 +77,12 @@ class User < ApplicationRecord end end - def subtitle - case provider - when "greenlight", "google", "twitter" - "User" - else - "Unknown" - end + # Retrives a list of all a users rooms that are not the main room, sorted by last session date. + def secondary_rooms + secondary = (rooms - [main_room]) + no_session, session = secondary.partition do |r| r.last_session.nil? end + sorted = session.sort_by do |r| r.last_session end + session + no_session end def firstname diff --git a/app/views/rooms/join.html.erb b/app/views/rooms/join.html.erb index 84d624fa..5ab7a080 100644 --- a/app/views/rooms/join.html.erb +++ b/app/views/rooms/join.html.erb @@ -1,5 +1,5 @@ <%= render 'shared/room_event' do %> - <%= form_for room_path, method: :post do |f| %> + <%= form_for room_path(@room), method: :post do |f| %>
<%= f.text_field :join_name, required: true, diff --git a/app/views/rooms/show.html.erb b/app/views/rooms/show.html.erb index 43f7ac78..b177bb63 100644 --- a/app/views/rooms/show.html.erb +++ b/app/views/rooms/show.html.erb @@ -37,7 +37,12 @@
<% if current_user.rooms.length > 1 %> - <% current_user.rooms.each do |room| %> +
+ <%= link_to current_user.main_room do %> + <%= render "shared/components/room_block", room: current_user.main_room %> + <% end %> +
+ <% current_user.secondary_rooms.each do |room| %>
<%= link_to room do %> <%= render "shared/components/room_block", room: room %> diff --git a/app/views/rooms/wait.html.erb b/app/views/rooms/wait.html.erb index c21093e5..cc7231e8 100644 --- a/app/views/rooms/wait.html.erb +++ b/app/views/rooms/wait.html.erb @@ -37,7 +37,7 @@ var request_to_join_meeting = function(){ }, error: function(){ // The meeting is still booting (going slowly), retry shortly. - if(join_attempts < 4){ setTimeout(request_to_join_meeting, 5000); } + if(join_attempts < 4){ setTimeout(request_to_join_meeting, 10000); } join_attempts++; } }); diff --git a/app/views/shared/_room_event.html.erb b/app/views/shared/_room_event.html.erb index ef0fcc4a..eafe8b19 100644 --- a/app/views/shared/_room_event.html.erb +++ b/app/views/shared/_room_event.html.erb @@ -25,4 +25,4 @@
-<%= render "shared/sessions", recordings: @recordings, only_public: true %> +<%= render "shared/sessions", recordings: @room.public_recordings, only_public: true %> diff --git a/app/views/shared/modals/_create_room_modal.html.erb b/app/views/shared/modals/_create_room_modal.html.erb index 5e7358bc..07aae0e3 100644 --- a/app/views/shared/modals/_create_room_modal.html.erb +++ b/app/views/shared/modals/_create_room_modal.html.erb @@ -12,7 +12,7 @@ - <%= f.text_field :name, id: "room-name", class: "form-control", placeholder: "Enter a room name...", autocomplete: :off %> + <%= f.text_field :name, id: "room-name", class: "form-control", value: "", placeholder: "Enter a room name...", autocomplete: :off %>
Room name cannot be blank.