Files
danbooru/app/presenters/post_set_presenters/base.rb
evazion 2cbe4d3672 search: add unaliased:<tag> metatag.
* Add unaliased:<tag> metatag. This allows you to search for a tag
  without applying aliases. This is mainly useful for debugging purposes
  and for searching for large tags that are in the process of being
  aliased but haven't had all their posts moved yet.

* Remove the "raw" url param from the posts index page. The "raw" param
  also caused the search to ignore aliases, but it was undocumented and
  exploitable. It was possible to use the raw param to view private
  favorites since favorites are treated like a hidden tag.
2020-04-30 17:45:07 -05:00

30 lines
691 B
Ruby

module PostSetPresenters
class Base
def posts
raise NotImplementedError
end
def post_previews_html(template, options = {})
html = ""
if none_shown(options)
return template.render("post_sets/blank")
end
posts.each do |post|
html << PostPresenter.preview(post, options.merge(:tags => @post_set.tag_string))
html << "\n"
end
html.html_safe
end
def not_shown(post, options)
!options[:show_deleted] && post.is_deleted? && @post_set.tag_string !~ /status:(?:all|any|deleted|banned)/
end
def none_shown(options)
posts.reject {|post| not_shown(post, options) }.empty?
end
end
end