dtext links: add search options for finding broken links.

Add "Wiki Exists?" and "Tag Exists?" options to /dtext_links. These can
be used to find links to wikis or tags that don't exist (broken links).
This commit is contained in:
evazion
2019-10-23 21:23:52 -05:00
parent 812cabfc07
commit 97a758dec6
3 changed files with 44 additions and 1 deletions

View File

@@ -52,6 +52,10 @@ class WikiPage < ApplicationRecord
end
end
def tag_matches(params)
where(title: Tag.search(params).select(:name).reorder(nil))
end
def default_order
order(updated_at: :desc)
end
@@ -70,6 +74,10 @@ class WikiPage < ApplicationRecord
q = q.other_names_match(params[:other_names_match])
end
if params[:tag].present?
q = q.tag_matches(params[:tag])
end
if params[:hide_deleted].to_s.truthy?
q = q.where("is_deleted = false")
end