Fix bug reported in forum #182766: The Download button on the posts page does not respect the Disable tagged filenames user setting. Tags are included in the filename when clicking the Download button even when the Disable tagged filenames setting is set to Yes. Right click -> Save As on the image still respects the setting.
25 lines
648 B
Ruby
25 lines
648 B
Ruby
class PostPresenter
|
|
attr_reader :pool, :next_post_in_pool
|
|
delegate :split_tag_list_text, to: :tag_set_presenter
|
|
|
|
def initialize(post)
|
|
@post = post
|
|
end
|
|
|
|
def tag_set_presenter
|
|
@tag_set_presenter ||= TagSetPresenter.new(@post.tag_array)
|
|
end
|
|
|
|
def humanized_essential_tag_string
|
|
@humanized_essential_tag_string ||= tag_set_presenter.humanized_essential_tag_string.presence || "##{@post.id}"
|
|
end
|
|
|
|
def filename_for_download(current_user)
|
|
if current_user.disable_tagged_filenames?
|
|
"#{@post.md5}.#{@post.file_ext}"
|
|
else
|
|
"#{humanized_essential_tag_string} - #{@post.md5}.#{@post.file_ext}"
|
|
end
|
|
end
|
|
end
|