show unlock date for files and pages in locked modules

test plan:
* create a module
* add a wiki page and an attachment as module items
* set the module to unlock on a future date
* try to visit the page or file as a student
* should show the unlock date in the message

closes #CNVS-6681

Change-Id: Id311b029bc8bfe7c087550ca233a40b4f6d3c543
Reviewed-on: https://gerrit.instructure.com/22190
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
This commit is contained in:
James Williams 2013-07-10 11:33:58 -06:00
parent c18188a670
commit 2df5b5b7e9
3 changed files with 3 additions and 1 deletions

View File

@ -1201,6 +1201,7 @@ class Attachment < ActiveRecord::Base
locked = {:asset_string => self.asset_string, :lock_at => self.lock_at}
elsif self.could_be_locked && item = locked_by_module_item?(user, opts[:deep_check_if_needed])
locked = {:asset_string => self.asset_string, :context_module => item.context_module.attributes}
locked[:unlock_at] = locked[:context_module]["unlock_at"] if locked[:context_module]["unlock_at"]
end
locked
end

View File

@ -198,6 +198,7 @@ class WikiPage < ActiveRecord::Base
locked = false
if (m && !m.available_for?(user))
locked = {:asset_string => self.asset_string, :context_module => m.attributes}
locked[:unlock_at] = locked[:context_module]["unlock_at"] if locked[:context_module]["unlock_at"]
end
locked
end

View File

@ -43,7 +43,7 @@ module HasContentTags
end
def locked_cache_key(user)
['_locked_for', self, user].cache_key
['_locked_for2', self, user].cache_key
end
def clear_locked_cache(user)