From 2f41b02e72169a9552b6f29cc04817613af173da Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Thu, 16 Apr 2020 12:31:57 -0400 Subject: [PATCH] Fixed server recordings 500 if user doesn't have an email (#1254) Co-authored-by: Jesus Federico --- app/controllers/concerns/recorder.rb | 9 ++++++++- app/helpers/admins_helper.rb | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/concerns/recorder.rb b/app/controllers/concerns/recorder.rb index 30a2dff2..68607977 100644 --- a/app/controllers/concerns/recorder.rb +++ b/app/controllers/concerns/recorder.rb @@ -88,7 +88,7 @@ module Recorder r[:name].downcase.include?(search)) || r[:participants].include?(search) || !r[:playbacks].select { |p| p[:type].downcase.include?(search) }.empty? || - (search_name && Room.find_by(bbb_id: r[:meetingID]).owner.email.downcase.include?(search)) + (search_name && recording_owner(r[:meetingID]).downcase.include?(search)) end end @@ -122,4 +122,11 @@ module Recorder recs.reverse end end + + private + + # Gets the email of the room owner to which the recording belongs to + def recording_owner(room_id) + Room.find_by(bbb_id: room_id).owner.email.presence || Room.find_by(bbb_id: room_id).owner.username + end end diff --git a/app/helpers/admins_helper.rb b/app/helpers/admins_helper.rb index 955d188e..86f8571f 100644 --- a/app/helpers/admins_helper.rb +++ b/app/helpers/admins_helper.rb @@ -21,7 +21,7 @@ module AdminsHelper # Gets the email of the room owner to which the recording belongs to def recording_owner_email(room_id) - Room.find_by(bbb_id: room_id).owner.email + Room.find_by(bbb_id: room_id).owner.email.presence || Room.find_by(bbb_id: room_id).owner.username end def admin_invite_registration