pools: add ability to search for pools linking to given tag.

Add ability to search for pools linking to a given tag in the pool
description. Example:

    https://danbooru.donmai.us/pools?search[linked_to]=touhou

(This isn't actually exposed in the UI to avoid cluttering the pool
search form with rarely used options.)

Pools with broken links can be found here:

    https://danbooru.donmai.us/dtext_links?search[has_linked_tag]=No&search[has_linked_wiki]=No&search[model_type]=Pool

Lays the groundwork for fixing #4629.
This commit is contained in:
evazion
2022-01-15 20:16:06 -06:00
parent c3c4f5a2a7
commit 33103f6dc4
10 changed files with 72 additions and 42 deletions

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<%= search_form_for(dtext_links_path) do |f| %>
<%= f.input :link_target_ilike, label: "Link", hint: "Use * for wildcard", input_html: { value: params[:search][:link_target_ilike], data: { autocomplete: "wiki-page" } } %>
<%= f.input :model_type, label: "Page Type", collection: [["Wiki Page", "WikiPage"], ["Forum Post", "ForumPost"]], include_blank: true, selected: params[:search][:model_type] %>
<%= f.input :model_type, label: "Page Type", collection: DtextLink.model_types.map { [_1.titleize, _1] }, include_blank: true, selected: params[:search][:model_type] %>
<%= f.input :link_type, label: "Link Type", collection: [["Wiki", "0"], ["External", "1"]], include_blank: true, selected: params[:search][:link_type] %>
<%= f.input :has_linked_wiki, label: "Wiki Exists?", collection: ["Yes", "No"], include_blank: true, selected: params[:search][:has_linked_wiki] %>
<%= f.input :has_linked_tag, label: "Tag Exists?", collection: ["Yes", "No"], include_blank: true, selected: params[:search][:has_linked_tag] %>
@@ -16,8 +16,8 @@
<%= link_to(dtext_link.model.title, dtext_link.model) %>
<%= link_to("»", dtext_links_path(search: { model_type: "WikiPage", model: { title: dtext_link.model.title }})) %>
</span>
<% elsif dtext_link.model_type == "ForumPost" %>
<%= link_to("forum ##{dtext_link.model_id}", dtext_link.model) %>
<% else %>
<%= link_to(dtext_link.model.dtext_shortlink, dtext_link.model) %>
<% end %>
<% end %>