Make room delete permanent (#2390)

This commit is contained in:
Ahmad Farhat 2020-12-24 13:54:27 -05:00 committed by GitHub
parent b2500e6504
commit c9b16729f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -137,7 +137,10 @@ class RoomsController < ApplicationController
begin begin
# Don't delete the users home room. # Don't delete the users home room.
raise I18n.t("room.delete.home_room") if @room == @room.owner.main_room raise I18n.t("room.delete.home_room") if @room == @room.owner.main_room
@room.destroy
# Destroy all recordings then permanently delete the room
delete_all_recordings(@room.bbb_id)
@room.destroy(true)
rescue => e rescue => e
flash[:alert] = I18n.t("room.delete.fail", error: e) flash[:alert] = I18n.t("room.delete.fail", error: e)
else else

View File

@ -155,6 +155,8 @@ class UsersController < ApplicationController
# Permanently delete the rooms under the user if they have not been reassigned # Permanently delete the rooms under the user if they have not been reassigned
if perm_delete if perm_delete
@user.rooms.include_deleted.each do |room| @user.rooms.include_deleted.each do |room|
# Destroy all recordings then permanently delete the room
delete_all_recordings(room.bbb_id)
room.destroy(true) room.destroy(true)
end end
end end

View File

@ -550,6 +550,7 @@ describe UsersController, type: :controller do
it "allows admins to permanently delete users" do it "allows admins to permanently delete users" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true) allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true) allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
allow_any_instance_of(BbbServer).to receive(:delete_all_recordings).and_return("")
allow_any_instance_of(ApplicationController).to receive(:set_user_domain).and_return("provider1") allow_any_instance_of(ApplicationController).to receive(:set_user_domain).and_return("provider1")
controller.instance_variable_set(:@user_domain, "provider1") controller.instance_variable_set(:@user_domain, "provider1")
@ -568,6 +569,7 @@ describe UsersController, type: :controller do
it "permanently deletes the users rooms if the user is permanently deleted" do it "permanently deletes the users rooms if the user is permanently deleted" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true) allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true) allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
allow_any_instance_of(BbbServer).to receive(:delete_all_recordings).and_return("")
allow_any_instance_of(ApplicationController).to receive(:set_user_domain).and_return("provider1") allow_any_instance_of(ApplicationController).to receive(:set_user_domain).and_return("provider1")
controller.instance_variable_set(:@user_domain, "provider1") controller.instance_variable_set(:@user_domain, "provider1")