diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index e6dcadc3..48bd65b5 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -3,6 +3,8 @@ class RoomsController < ApplicationController before_action :find_room, except: :create before_action :verify_room_ownership, only: [:start, :destroy, :home] + META_LISTED = "gl-listed" + # POST /r def create room = Room.new(name: room_params[:name]) @@ -90,11 +92,16 @@ class RoomsController < ApplicationController redirect_to @room end - # PATCH /r/:room_uid/:record_id + # POST /r/:room_uid/:record_id def update_recording - bbb.publish_recordings(params[:record_id], params[:publish]) - - + meta = { + "meta_#{META_LISTED}": (params[:state] == "public") + } + puts '-------------' + puts params[:record_id] + res = @room.update_recording(params[:record_id], meta) + puts res + redirect_to @room if res[:updated] end # DELETE /r/:room_uid/:record_id diff --git a/app/models/room.rb b/app/models/room.rb index a8244ed0..210eea21 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -32,7 +32,8 @@ class Room < ApplicationRecord logoutURL: options[:meeting_logout_url] || '', moderatorPW: random_password(12), attendeePW: random_password(12), - moderatorOnlyMessage: options[:moderator_message] + moderatorOnlyMessage: options[:moderator_message], + "meta_gl-listed": false } # Increment room sessions. @@ -81,11 +82,11 @@ class Room < ApplicationRecord end # Generate the join URL. - if uid - bbb.join_meeting_url(bbb_id, name, password, {userID: uid}) - else - bbb.join_meeting_url(bbb_id, name, password) - end + join_opts = {} + join_opts.merge!({userID: uid}) if uid + join_opts.merge!({joinViaHtml5: true}) if Rails.configuration.html5_enabled + + bbb.join_meeting_url(bbb_id, name, password, join_opts) end # Notify waiting users that a meeting has started. @@ -129,6 +130,12 @@ class Room < ApplicationRecord res[:recordings] end + def update_recording(record_id, meta) + meta.merge!({recordID: record_id}) + + bbb.send_api_request("updateRecordings", meta) + end + # Deletes a recording from a room. def delete_recording(record_id) res = bbb.delete_recordings(record_id) diff --git a/app/views/rooms/show.html.erb b/app/views/rooms/show.html.erb index fa87f9b7..ac1c6d6b 100644 --- a/app/views/rooms/show.html.erb +++ b/app/views/rooms/show.html.erb @@ -28,7 +28,7 @@