thumbnails inherit their s3 bucket from their attachment
test plan: * enable s3 storage * configure plugin settings to a different bucket than s3.yml * ensure that avatar thumbnails are uploaded and retrieved from the different bucket Change-Id: I7fbf09fa8423c7a916d3b0a602606e2370b7837c Reviewed-on: https://gerrit.instructure.com/10942 Tested-by: Cody Cutrer <cody@instructure.com> Reviewed-by: Brian Palmer <brianp@instructure.com>
This commit is contained in:
parent
66cf420939
commit
1db16b3426
|
@ -40,6 +40,10 @@ class Thumbnail < ActiveRecord::Base
|
|||
:keep_profile => true
|
||||
end
|
||||
|
||||
def bucket_name
|
||||
self.attachment.bucket_name
|
||||
end
|
||||
|
||||
def cached_s3_url
|
||||
@cached_s3_url = authenticated_s3_url(:expires_in => 144.hours)
|
||||
end
|
||||
|
|
|
@ -770,6 +770,11 @@ describe Attachment do
|
|||
Attachment.domain_namespace = nil
|
||||
attachment_model
|
||||
@attachment.s3_config[:bucket_name].should == 'pluginsetting_bucket'
|
||||
# if local storage is configured, this will return "no-bucket"
|
||||
@attachment.stubs(:bucket_name).returns('pluginsetting_bucket')
|
||||
|
||||
# thumbnails should use the same bucket as the attachment they are parented to
|
||||
Thumbnail.new(:attachment => @attachment).bucket_name.should == 'pluginsetting_bucket'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue