fix locked discussions before due date
fixes VICE-4515 flag=discussion_create test plan: - create an UNgraded discussion with an "available until" field - edit the discussion to be graded - set a new available until date - the discussion's available until date should match the assignment's Change-Id: Ie385f9ec2c71d02cfa1ccf9a4a4aeeed9231db0c Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/355570 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Product-Review: Tamás Balogh <tamas.balogh@instructure.com> Reviewed-by: Daniel Matyas Vincze <daniel.vincze@instructure.com> QA-Review: Theo Sorriaux <theo.sorriaux@instructure.com>
This commit is contained in:
parent
27acf7ef9c
commit
86a3e7318f
|
@ -101,6 +101,7 @@ class Mutations::UpdateDiscussionTopic < Mutations::DiscussionBase
|
|||
# Instantiate and execute UpdateAssignment mutation
|
||||
assignment_mutation = Mutations::UpdateAssignment.new(object: nil, context:, field: nil)
|
||||
assignment_result = assignment_mutation.resolve(input: updated_assignment_args)
|
||||
discussion_topic.lock_at = input[:assignment][:lock_at] if input[:assignment][:lock_at]
|
||||
|
||||
if assignment_result[:errors]
|
||||
return { errors: assignment_result[:errors] }
|
||||
|
|
|
@ -156,6 +156,7 @@ RSpec.describe Mutations::UpdateDiscussionTopic do
|
|||
args << peer_reviews_str(assignment[:peerReviews]) if assignment[:peerReviews]
|
||||
args << assignment_overrides_str(assignment[:assignmentOverrides]) if assignment[:assignmentOverrides]
|
||||
args << "forCheckpoints: #{assignment[:forCheckpoints]}" if assignment[:forCheckpoints]
|
||||
args << "lockAt: \"#{assignment[:lockAt]}\"" if assignment[:lockAt]
|
||||
|
||||
"assignment: { #{args.join(", ")} }"
|
||||
end
|
||||
|
@ -619,6 +620,14 @@ RSpec.describe Mutations::UpdateDiscussionTopic do
|
|||
|
||||
expect(result["errors"]).to be_nil
|
||||
end
|
||||
|
||||
it "syncs the discussion and assignment lock_at field when the assignment date changes" do
|
||||
lock_at = 6.months.from_now.iso8601
|
||||
expect(@topic.lock_at).to be_nil
|
||||
result = run_mutation(id: @topic.id, assignment: { lockAt: lock_at.to_s })
|
||||
expect(result["errors"]).to be_nil
|
||||
expect(@topic.reload.lock_at).to eq lock_at.to_s
|
||||
end
|
||||
end
|
||||
|
||||
context "discussion checkpoints" do
|
||||
|
|
Loading…
Reference in New Issue