From 9d39754e489fe02267424975914e705f3fb57ca0 Mon Sep 17 00:00:00 2001 From: Derek Bender Date: Fri, 6 Oct 2017 10:52:46 -0500 Subject: [PATCH] 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 Reviewed-by: Keith T. Garner Tested-by: Jenkins QA-Review: KC Naegle Product-Review: Keith T. Garner --- app/models/canvadoc.rb | 2 +- spec/models/canvadoc_spec.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/canvadoc.rb b/app/models/canvadoc.rb index 7790cc61d6f..4084982f3e6 100644 --- a/app/models/canvadoc.rb +++ b/app/models/canvadoc.rb @@ -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 diff --git a/spec/models/canvadoc_spec.rb b/spec/models/canvadoc_spec.rb index f348617b79d..b793ce53b66 100644 --- a/spec/models/canvadoc_spec.rb +++ b/spec/models/canvadoc_spec.rb @@ -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