Skip to content

Commit

Permalink
fix has_annotations?
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Keith T. Garner <[email protected]>
Tested-by: Jenkins
QA-Review: KC Naegle <[email protected]>
Product-Review: Keith T. Garner <[email protected]>
  • Loading branch information
djbender authored and ktgeek committed Oct 6, 2017
1 parent 1a79bdd commit a6216e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/canvadoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def has_annotations?
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
Expand Down
12 changes: 12 additions & 0 deletions spec/models/canvadoc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,16 @@ def disable_canvadocs
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

0 comments on commit a6216e9

Please sign in to comment.