GRN-59: Implemented pagination on the API call (#370)

* Added the env variable and functionality to paginate the call to the bbbapi

* Update user.rb
This commit is contained in:
farhatahmad
2019-03-12 13:50:20 -04:00
committed by Jesus Federico
parent ab6655554c
commit 3195bb4429
12 changed files with 278 additions and 124 deletions

View File

@ -17,11 +17,11 @@
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
class UsersController < ApplicationController
include RecordingsHelper
before_action :find_user, only: [:edit, :update, :destroy]
before_action :ensure_unauthenticated, only: [:new, :create]
include RecordingsHelper
# POST /u
def create
# Verify that GreenLight is configured to allow user signup.
@ -135,19 +135,7 @@ class UsersController < ApplicationController
# GET /u/:user_uid/recordings
def recordings
if current_user && current_user.uid == params[:user_uid]
@recordings = []
current_user.rooms.each do |room|
# Check that current user is the room owner
next unless room.owner == current_user
recs = room.recordings
# Add the room id to each recording object
recs.each do |rec|
rec[:room_uid] = room.uid
end
# Adds an array to another array
@recordings.push(*recs)
end
@recordings = current_user.all_recordings
else
redirect_to root_path
end