show quiz descriptions to observers
test plan: * be an observer * should be able to see quiz descriptions (if published) closes #CNVS-31029 Change-Id: I5f77d379c9540698fc8ee4d3f6066c846aaacccc Reviewed-on: https://gerrit.instructure.com/90985 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Heath Hales <hhales@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
95718bd114
commit
1be3e21887
|
@ -176,7 +176,8 @@ class Quizzes::QuizzesController < ApplicationController
|
|||
if session[:quiz_id] == @quiz.id && !request.xhr?
|
||||
session.delete(:quiz_id)
|
||||
end
|
||||
@locked_reason = @quiz.locked_for?(@current_user, :check_policies => true, :deep_check_if_needed => true)
|
||||
is_observer = @context_enrollment && @context_enrollment.observer?
|
||||
@locked_reason = @quiz.locked_for?(@current_user, :check_policies => true, :deep_check_if_needed => true, :is_observer => is_observer)
|
||||
@locked = @locked_reason && !can_preview?
|
||||
|
||||
@context_module_tag = ContextModuleItem.find_tag_with_preferred([@quiz, @quiz.assignment], params[:module_item_id])
|
||||
|
|
|
@ -748,7 +748,7 @@ class Quizzes::Quiz < ActiveRecord::Base
|
|||
locked = assignment_lock
|
||||
elsif (module_lock = locked_by_module_item?(user, opts[:deep_check_if_needed]))
|
||||
locked = lock_info.merge({ context_module: module_lock.context_module.attributes })
|
||||
elsif !context.try_rescue(:is_public) && !context.grants_right?(user, :participate_as_student)
|
||||
elsif !context.try_rescue(:is_public) && !context.grants_right?(user, :participate_as_student) && !opts[:is_observer]
|
||||
locked = lock_info.merge({ missing_permission: :participate_as_student.to_s })
|
||||
end
|
||||
|
||||
|
|
|
@ -235,4 +235,21 @@ describe 'quizzes' do
|
|||
take_and_answer_quiz
|
||||
expect(f("#section-tabs .grades .nav-badge").text).to eq "1"
|
||||
end
|
||||
|
||||
it "should show quiz descriptions to observers" do
|
||||
@context = @course
|
||||
quiz = quiz_model
|
||||
description = "some description"
|
||||
quiz.description = description
|
||||
quiz.save!
|
||||
|
||||
@student = @user
|
||||
@observer = user
|
||||
@course.enroll_user(@observer, 'ObserverEnrollment', :enrollment_state => 'active', :associated_user_id => @student.id)
|
||||
user_session(@observer)
|
||||
|
||||
open_quiz_show_page
|
||||
|
||||
expect(f(".description")).to include_text(description)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue