forked from External/greenlight
implement wait for moderator
This commit is contained in:
parent
4037b6304e
commit
e6d01ef1b9
|
@ -0,0 +1,29 @@
|
|||
$(document).on("turbolinks:load", function() {
|
||||
|
||||
var action = $("body").data('action');
|
||||
var controller = $("body").data('controller');
|
||||
|
||||
// If the user is on the waiting screen.
|
||||
if (controller == 'meetings' && action == 'wait') {
|
||||
|
||||
setTimeout(refresh, 10000);
|
||||
}
|
||||
});
|
||||
|
||||
// Send a request to the meeting wait endpoint.
|
||||
// This checks if the meeting is running on the
|
||||
// server and will auto join the user if it is.
|
||||
var refresh = function() {
|
||||
$.ajax({
|
||||
url: window.location.pathname,
|
||||
type: 'POST',
|
||||
data: {
|
||||
unauthenticated_join_name: $('#unauthenticated_join_name_').val()
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(refresh, 10000);
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Users controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -42,7 +42,7 @@ class MeetingsController < ApplicationController
|
|||
if params[:join_name]
|
||||
redirect_to @meeting.join_path(params[:join_name], opts)
|
||||
else
|
||||
# Render the join page so they can supploy their name.
|
||||
# Render the join page so they can supply their name.
|
||||
render :join
|
||||
end
|
||||
end
|
||||
|
@ -54,15 +54,33 @@ class MeetingsController < ApplicationController
|
|||
else
|
||||
# Send the user to a polling page that will auto join them when it starts.
|
||||
# The wait action/page handles input of name for unauthenticated users.
|
||||
render :wait
|
||||
redirect_to wait_meeting_path(room_uid: @meeting.room.uid, meeting_uid: @meeting.uid)
|
||||
end
|
||||
end
|
||||
else
|
||||
# Handle meeting doesn't exist.
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# GET /rooms/:room_uid/meetings/:meeting_uid/wait
|
||||
def wait
|
||||
@meeting = Meeting.find_by(uid: params[:meeting_uid])
|
||||
|
||||
if @meeting
|
||||
if @meeting.is_running?
|
||||
if current_user
|
||||
# If they are logged in and waiting, use their account name.
|
||||
redirect_to @meeting.join_path(current_user.name, default_meeting_options)
|
||||
elsif !params[:unauthenticated_join_name].blank?
|
||||
# Otherwise, use the name they submitted on the wating page.
|
||||
redirect_to @meeting.join_path(params[:unauthenticated_join_name], default_meeting_options)
|
||||
end
|
||||
end
|
||||
else
|
||||
# Handle meeting doesn't exist.
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -75,6 +93,7 @@ class MeetingsController < ApplicationController
|
|||
{
|
||||
user_is_moderator: false,
|
||||
meeting_logout_url: request.base_url + room_path(room_uid: @meeting.room.uid),
|
||||
meeting_recorded: true,
|
||||
moderator_message: "To invite someone to the meeting, send them this link:
|
||||
#{request.base_url + join_meeting_path(room_uid: @meeting.room.uid, meeting_uid: @meeting.uid)}"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
class UsersController < ApplicationController
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module UsersHelper
|
||||
end
|
|
@ -38,7 +38,6 @@ class Meeting < ApplicationRecord
|
|||
options[:meeting_logout_url] ||= nil
|
||||
options[:moderator_message] ||= ''
|
||||
options[:user_is_moderator] ||= false
|
||||
|
||||
options[:meeting_recorded] ||= false
|
||||
|
||||
#options[:wait_for_moderator] ||= false
|
||||
|
@ -61,6 +60,12 @@ class Meeting < ApplicationRecord
|
|||
bbb.join_meeting_url(uid, username, password)
|
||||
end
|
||||
|
||||
# Fetches all recordings for a meeting.
|
||||
def recordings
|
||||
res = bbb.get_recordings(meetingID: uid)
|
||||
res[:recordings]
|
||||
end
|
||||
|
||||
# Checks if a meeting is running on the BigBlueButton server.
|
||||
def is_running?
|
||||
begin
|
||||
|
|
|
@ -1 +1,7 @@
|
|||
<p>waiting for meeting to start...</p>
|
||||
<p>Waiting for meeting to start...</p>
|
||||
<p>You will be redirected when the meeing starts...</p>
|
||||
|
||||
<% unless current_user %>
|
||||
<p>Input a name for when the meeting starts.</p>
|
||||
<%= text_field(:unauthenticated_join_name, nil) %>
|
||||
<% end %>
|
|
@ -15,7 +15,7 @@
|
|||
<br><br><br><br><br>
|
||||
<p>Previous Sessions</p>
|
||||
<% current_user.room.meetings.each do |m| %>
|
||||
<p><%= m.name + " " + m.is_running?.to_s %></p>
|
||||
<p><%= m.name + " " + m.is_running?.to_s + " " + m.recordings.to_s %></p>
|
||||
<% end %>
|
||||
<br>
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UsersControllerTest < ActionDispatch::IntegrationTest
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue