Only generate tagged filenames for URLs on post show pages (#3597).

Don't generate tagged filenames for urls in the data attributes on
thumbnails, or in the /posts.json api.
This commit is contained in:
evazion
2018-04-05 14:03:41 -05:00
parent 14977397fb
commit 084fcd91ed
10 changed files with 28 additions and 19 deletions

View File

@@ -145,6 +145,14 @@ class Post < ApplicationRecord
storage_manager.open_file(self, type)
end
def tagged_file_url
storage_manager.file_url(self, :original, tagged_filenames: !CurrentUser.user.disable_tagged_filenames?)
end
def tagged_large_file_url
storage_manager.file_url(self, :large, tagged_filenames: !CurrentUser.user.disable_tagged_filenames?)
end
def file_url
storage_manager.file_url(self, :original)
end
@@ -171,9 +179,9 @@ class Post < ApplicationRecord
def file_url_for(user)
if user.default_image_size == "large" && image_width > Danbooru.config.large_image_width
large_file_url
tagged_large_file_url
else
file_url
tagged_file_url
end
end