Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRN2-xx: Added an auto-refresh after 2 mins while waiting for room to start #1947

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/assets/javascripts/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ $(document).on('turbolinks:load', function(){
$("#create-room-block").click(function(){
showCreateRoom(this)
})

checkIfAutoJoin()
}

// Autofocus on the Room Name label when creating a room only
Expand Down Expand Up @@ -263,4 +265,14 @@ function removeSharedUser(target) {
parentLI.removeChild(target)
parentLI.classList.add("remove-shared")
}
}

// Automatically click the join button if this is an action cable reload
function checkIfAutoJoin() {
var url = new URL(window.location.href)

if (url.searchParams.get("reload") == "true") {
$("#joiner-consent").click()
$("#room-join").click()
}
}
8 changes: 8 additions & 0 deletions app/assets/javascripts/wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ $(document).on("turbolinks:load", function(){
}, {
connected: function() {
console.log("connected");
setTimeout(startRefreshTimeout, 120000);
},

disconnected: function(data) {
Expand Down Expand Up @@ -68,3 +69,10 @@ var request_to_join_meeting = function(){
}
});
}

// Refresh the page after 2 mins and attempt to reconnect to ActionCable
function startRefreshTimeout() {
var url = new URL(window.location.href)
url.searchParams.set("reload","true")
window.location.href = url.href
}
4 changes: 2 additions & 2 deletions app/views/rooms/join.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
autofocus: true
%>
<span class="input-group-append">
<button type="submit" class="btn btn-primary btn-sm px-7 form-control join-form">
<button id="room-join" type="submit" class="btn btn-primary btn-sm px-7 form-control join-form">
<%= (!@room_running && @anyone_can_start) ? t("room.start") : t("room.join") %>
</button>
</span>
</div>
<% if recording_consent_required? && @room.recording_enabled? %>
<label class="custom-control custom-checkbox">
<input id="delete-checkbox" type="checkbox" class="custom-control-input" required>
<input id="joiner-consent" type="checkbox" class="custom-control-input" required>
<h4 class="text-left text-danger mt-4 custom-control-label"><%= t("room.recording_present") %></h4>
</label>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/rooms_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def random_valid_room_params

it "properly updates room name through the room settings modal and redirects to current page" do
@request.session[:user_id] = @user.id
name = Faker::Games::Pokemon.name
name = Faker::Name.first_name

room_params = { room_uid: @secondary_room.uid, room: { "name": name } }

Expand Down