fix has_annotations?

fixes: GRADE-339

test plan:
  - with new annotations disabled
  - have a course with an assignment that requires a file upload
  - have a student submit the assignment with a doc pdf or docx file
    type
  - as the student or teacher go to the assignment submissions page
  - as a student click 'Grades'
  - click the assignment that was previously submitted
  - ensure that the document preview loads without errors
  - as a teacher click 'Grades'
  - click the students name
  - click the assignment that was previously submitted
  - ensure that the document preview loads without errors

Change-Id: Idd6984aae779205b247927843da8c8acfb5a33d6
Reviewed-on: https://gerrit.instructure.com/128803
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
This commit is contained in:
Derek Bender 2017-10-06 10:52:46 -05:00
parent dc1ecf70fc
commit 9d39754e48
2 changed files with 13 additions and 1 deletions

View File

@ -61,7 +61,7 @@ class Canvadoc < ActiveRecord::Base
account_context = attachment.context.try(:account)
account_context ||= attachment.context.try(:root_account)
new_annotations_enabled = account_context&.feature_enabled?(:new_annotations)
new_annotations_enabled || annotations == true
new_annotations_enabled || has_annotations == true
end
def self.mime_types

View File

@ -121,4 +121,16 @@ describe 'Canvadoc' do
expect(@doc).not_to be_available
end
end
describe "#has_annotations?" do
it "has annotations when true and new annotations are not enabled" do
@doc.has_annotations = true
expect(@doc).to have_annotations
end
it "does not have annotations when false and new annotations are not enabled" do
@doc.has_annotations = false
expect(@doc).not_to have_annotations
end
end
end