Persist start and end date from Calendar to BBB

flag=bbb_modal_update
closes VICE-3122
closes VICE-3132

test plan:
  - Tests pass
  - Go to Calendar
  - Set time fields and create BBB event
  - Go to BBB on the course and make sure the data is there
  - Go back to Calendar
  - Edit the created conference times
  - Go to BBB on the course and make sure the updated data is there

qa risk: low

Change-Id: I968458ec9ebe8df73cde549adc0aa48590913589
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301703
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jason Gillett <jason.gillett@instructure.com>
Product-Review: Chawn Neal <chawn.neal@instructure.com>
Reviewed-by: Jason Gillett <jason.gillett@instructure.com>
Reviewed-by: Chawn Neal <chawn.neal@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
This commit is contained in:
Omar Gerardo Soto-Fortuño 2022-09-23 08:45:30 -04:00 committed by Omar Soto-Fortuño
parent 4b2fccfbdb
commit eb43a5fce7
3 changed files with 78 additions and 3 deletions

View File

@ -531,7 +531,12 @@ class CalendarEventsApiController < ApplicationController
params_for_create[:description] = process_incoming_html_content(params_for_create[:description])
end
if params_for_create.key?(:web_conference)
params_for_create[:web_conference] = find_or_initialize_conference(@context, params_for_create[:web_conference])
web_conference_params = params_for_create[:web_conference]
unless web_conference_params.empty?
web_conference_params[:start_at] = params_for_create[:start_at]
web_conference_params[:end_at] = params_for_create[:end_at]
end
params_for_create[:web_conference] = find_or_initialize_conference(@context, web_conference_params)
end
@event = @context.calendar_events.build(params_for_create)
@ -756,7 +761,12 @@ class CalendarEventsApiController < ApplicationController
params_for_update[:description] = process_incoming_html_content(params_for_update[:description])
end
if params_for_update.key?(:web_conference)
web_conference = find_or_initialize_conference(@event.context, params_for_update[:web_conference])
web_conference_params = params_for_update[:web_conference]
unless web_conference_params.empty?
web_conference_params[:start_at] = params_for_update[:start_at]
web_conference_params[:end_at] = params_for_update[:end_at]
end
web_conference = find_or_initialize_conference(@event.context, web_conference_params)
return unless authorize_user_for_conference(@current_user, web_conference)
params_for_update[:web_conference] = web_conference

View File

@ -40,7 +40,7 @@ module CalendarConferencesHelper
def find_or_initialize_conference(context, conference_params, override_params = {})
return nil if conference_params.blank?
valid_params = conference_params.merge(override_params).slice(:title, :description, :conference_type, :lti_settings, :user_settings)
valid_params = conference_params.merge(override_params).slice(:title, :description, :conference_type, :lti_settings, :user_settings, :start_at, :end_at)
if conference_params[:id]
WebConference.find(conference_params[:id]).tap do |conf|

View File

@ -177,6 +177,71 @@ describe "BigBlueButton conferences" do
lock_options = ff("input[name='attendees_options']")
expect(lock_options).to all(be_disabled)
end
it "sets start and end date on WebConference when created and edited from the calendar" do
get "/calendar"
# Create calendar event with conference
f("a#create_new_event_link").click
f("input[placeholder='Input Event Title...']").send_keys "BBB Conference from Calendar"
f("input[data-testid='event-form-start-time']").click
f("input[data-testid='event-form-start-time']").send_keys(:arrow_down)
f("input[data-testid='event-form-start-time']").send_keys(:enter)
f("input[data-testid='event-form-end-time']").click
5.times { f("input[data-testid='event-form-end-time']").send_keys(:arrow_down) }
f("input[data-testid='event-form-end-time']").send_keys(:enter)
f("input[data-testid='edit-calendar-event-form-context']").click
f("input[data-testid='edit-calendar-event-form-context']").send_keys(:arrow_down)
f("input[data-testid='edit-calendar-event-form-context']").send_keys(:enter)
fj('button:contains("Add BigBlueButton")').click
wait_for_ajaximations
f("button[type=submit]").click
ce = CalendarEvent.last
wc = WebConference.last
wc_before_start_at = wc.start_at
wc_before_end_at = wc.end_at
# Make sure values are correctly and as expected
expect(ce.web_conference_id).to eq wc.id
expect(wc.title).to eq "BBB Conference from Calendar"
expect(ce.start_at).to eq wc.start_at
expect(ce.end_at).to eq wc.end_at
# Edit calendar event
fj("a:contains('BBB Conference from Calendar')").click
fj('button:contains("Edit")').click
f("input[data-testid='event-form-start-time']").click
5.times { f("input[data-testid='event-form-start-time']").send_keys(:arrow_down) }
f("input[data-testid='event-form-start-time']").send_keys(:enter)
f("input[data-testid='event-form-end-time']").click
10.times { f("input[data-testid='event-form-end-time']").send_keys(:arrow_down) }
f("input[data-testid='event-form-end-time']").send_keys(:enter)
f("button[type=submit]").click
wait_for_ajaximations
ce.reload
wc.reload
wc_after_start_at = wc.start_at
wc_after_end_at = wc.end_at
# Make sure edited values are correctly and as expected
expect(ce.start_at).to eq wc.start_at
expect(ce.end_at).to eq wc.end_at
expect(wc_before_start_at).to be < wc_after_start_at
expect(wc_before_end_at).to be < wc_after_end_at
end
end
context "when bbb_modal_update is OFF" do