allow comments download in soft concluded courses
closes GRADE-1994 Test Plan - As a teacher, create an assignment. - Leave some submission comments. - As an admin, set the term to have a concluded date in the past. - As a teacher, navigate to the now soft-deleted course. - Navigate to SpeedGrader and attempt to download the submission comments. - Verify that the submission comment pdf renders. Change-Id: I1e45f07bbd8ea2483d93de894f1f3108635889ac Reviewed-on: https://gerrit.instructure.com/182369 Tested-by: Jenkins Reviewed-by: Jeremy Neander <jneander@instructure.com> Reviewed-by: Derek Bender <djbender@instructure.com> Reviewed-by: Adrian Packel <apackel@instructure.com> QA-Review: James Butters <jbutters@instructure.com> Product-Review: Keith Garner <kgarner@instructure.com>
This commit is contained in:
parent
0d09824442
commit
7b9d915ecc
|
@ -21,8 +21,9 @@ class SubmissionCommentsController < ApplicationController
|
|||
|
||||
def index
|
||||
submission = Submission.preload(assignment: :context, all_submission_comments: :author).find(params[:submission_id])
|
||||
course = submission.assignment.context
|
||||
return render_unauthorized_action if submission.assignment.anonymize_students?
|
||||
return render_unauthorized_action unless submission.grants_all_rights?(@current_user, :read_grade, :read_comments)
|
||||
return render_unauthorized_action unless course.grants_any_right?(@current_user, :manage_grades, :view_all_grades)
|
||||
|
||||
render pdf: :index, locals: index_pdf_locals(submission)
|
||||
end
|
||||
|
|
|
@ -21,10 +21,10 @@ require_relative '../spec_helper'
|
|||
RSpec.describe SubmissionCommentsController do
|
||||
describe "GET 'index'" do
|
||||
before :once do
|
||||
course = Account.default.courses.create!
|
||||
@teacher = course_with_teacher(course: course, active_all: true).user
|
||||
@student = course_with_student(course: course, active_all: true).user
|
||||
@assignment = course.assignments.create!
|
||||
@course = Account.default.courses.create!
|
||||
@teacher = course_with_teacher(course: @course, active_all: true).user
|
||||
@student = course_with_student(course: @course, active_all: true).user
|
||||
@assignment = @course.assignments.create!
|
||||
@submission = @assignment.submissions.find_by!(user: @student)
|
||||
@submission.submission_comments.create!(author: @teacher, comment: 'a comment')
|
||||
end
|
||||
|
@ -42,6 +42,20 @@ RSpec.describe SubmissionCommentsController do
|
|||
specify { expect(response.headers.fetch('Content-Type')).to match(/\Aapplication\/pdf/) }
|
||||
end
|
||||
|
||||
context "when course is in a concluded term" do
|
||||
before :once do
|
||||
@course.enrollment_term.update!(end_at: 1.day.ago)
|
||||
end
|
||||
|
||||
before do
|
||||
get :index, params: { submission_id: @submission.id }, format: :pdf
|
||||
end
|
||||
|
||||
specify { expect(response).to have_http_status :ok }
|
||||
specify { expect(response).to render_template(:index) }
|
||||
specify { expect(response.headers.fetch('Content-Type')).to match(/\Aapplication\/pdf/) }
|
||||
end
|
||||
|
||||
context 'given a request where no submission is present' do
|
||||
before do
|
||||
@submission.all_submission_comments.destroy_all
|
||||
|
|
Loading…
Reference in New Issue