add cdn hosted flag to posts

This commit is contained in:
r888888888
2017-02-07 17:26:16 -08:00
parent c01f48f18c
commit b57b54113f
3 changed files with 29 additions and 2 deletions

View File

@@ -105,7 +105,11 @@ class Post < ActiveRecord::Base
end
def file_url
"/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
if cdn_hosted?
Danbooru.config.danbooru_s3_base_url + "/#{file_path_prefix}#{md5}.#{file_ext}"
else
"/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
end
end
def large_file_url
@@ -1709,6 +1713,7 @@ class Post < ActiveRecord::Base
BOOLEAN_ATTRIBUTES = %w(
has_embedded_notes
cdn_hosted
)
has_bit_flags BOOLEAN_ATTRIBUTES