Explicitly nullify web_conference reference
When WebConference#destroy is called the association with the calendar_event child is set to :nullify. Rails is supposed to nullify that relationship as part of the destroy callbacks. I wasn't able to recreate the issue happening in practice, we even have tests that are checking it already. The logs in Splunk are showing that it is still happening occasionally so the fix here is to nullify the association manually before the record is deleted. It's calling the same method used in the callbacks for the destroy call. fixes LS-3145 flag=none test plan: - Create a web conference - Create a calendar event and attach the web conference - Delete the web conference - Verify the deletion was successful and that the calendar event is still there but has no relationship to a web conference Change-Id: Id3d3c6205da3367d2ac5d74ad8c454c890fab44f Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292815 Product-Review: Eric Saupe <eric.saupe@instructure.com> Reviewed-by: Ed Schiebel <eschiebel@instructure.com> QA-Review: Ed Schiebel <eschiebel@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
7e6ff7858a
commit
703b5d88a6
|
@ -457,6 +457,7 @@ class ConferencesController < ApplicationController
|
|||
if authorized_action(@conference, @current_user, :delete)
|
||||
@conference.transaction do
|
||||
@conference.web_conference_participants.scope.delete_all
|
||||
@conference.calendar_event&.update_columns(web_conference_id: nil) # explicitly nullify the calendar_event
|
||||
@conference.destroy
|
||||
end
|
||||
respond_to do |format|
|
||||
|
|
|
@ -336,6 +336,20 @@ describe ConferencesController do
|
|||
end
|
||||
end
|
||||
|
||||
describe "DELETE 'destroy'" do
|
||||
it "removes participants and the calendar event association" do
|
||||
user_session(@teacher)
|
||||
@conference = @course.web_conferences.create!(conference_type: "Wimba", duration: 60, user: @teacher)
|
||||
@conference.users << @student
|
||||
@conference.calendar_event = calendar_event_model
|
||||
@conference.save!
|
||||
delete "destroy", params: { course_id: @course.id, id: @conference.id }
|
||||
expect(response).to be_redirect
|
||||
expect(WebConference.exists?(@conference.id)).to eq(false)
|
||||
expect(@event.reload.web_conference_id).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context "LTI conferences" do
|
||||
before(:once) do
|
||||
Account.site_admin.enable_feature! :conference_selection_lti_placement
|
||||
|
|
Loading…
Reference in New Issue