Commit Graph

15 Commits

Author SHA1 Message Date
evazion
88ac91f5f3 search: refactor to pass in the current user explicitly. 2022-09-22 04:31:21 -05:00
evazion
33103f6dc4 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.
2022-01-15 20:26:30 -06:00
evazion
a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00
evazion
79fdfa86ae Fix various rubocop warnings. 2021-09-27 00:46:13 -05:00
evazion
4320e2ef70 dtext links: fix links from mod-only forum posts being exposed.
Fix links from mod-only forum posts being publicly visible in the
/dtext_links page.
2021-03-10 03:08:49 -06:00
evazion
ee4516f5fe searchable: refactor searchable_includes.
Pass searchable associations directly to search_attributes instead of
defining them separately in searchable_includes.
2020-12-16 23:57:07 -06:00
evazion
e771c0fca8 searchable: don't automatically include id, created_at, updated_at.
Don't make search methods on models call super in order to search
certain default attributes (id, created_at, updated_at). Simplifies some
magic.
2020-12-16 23:57:07 -06:00
BrokenEagle
c938119eae Add additional includes 2020-07-27 19:29:18 +00:00
BrokenEagle
c4009efccd Convert models to use new search includes mechanism 2020-07-27 19:29:18 +00:00
evazion
7e67d3dd9c views: replace .category-N css classes with .tag-type-N
* Replace the .category-N CSS classes on tags with .tag-type-N. Before
  we were inconsistent about whether tag colors were indicated with
  .category-N or .tag-type-N. Now it's always .tag-type-N.

* Fix various places to not use Tag.category_for. Tag.category_for does
  one Redis call per tag lookup, which leads to N Redis calls on many
  pages. This was inefficient because usually we either already had the
  tags from the database, or we could fetch them easily.
2020-02-16 04:35:37 -06:00
BrokenEagle
63b3503bfc Add ability to use nested only parameter
- The only string works much the same as before with its comma separation
-- Nested includes are indicated with square brackets "[ ]"
-- The nested include is the value immediately preceding the square brackets
-- The only string is the comma separated string inside those brackets
- Default includes are split between format types when necessary
-- This prevents unnecessary includes from being added on page load
- Available includes are those items which are allowed to be accessible to the user
-- Some aren't because they are sensitive, such as the creator of a flag
-- Some aren't because the number of associated items is too large
- The amount of times the same model can be included to prevent recursions
-- One exception is the root model may include the same model once
--- e.g. the user model can include the inviter which is also the user model
-- Another exception is if the include is a has_many association
--- e.g. artist urls can include the artist, and then artist urls again
2020-02-12 23:58:53 +00:00
evazion
d617b20b49 dtext links: allow searching for forum posts linking to specific tag. 2019-10-27 01:05:54 -05:00
evazion
97a758dec6 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).
2019-10-23 21:36:48 -05:00
evazion
812cabfc07 dtext links: add basic index page. 2019-10-23 21:36:48 -05:00
evazion
9f0ecf7247 dtext links: add table for tracking links between wikis.
Add a dtext_links table for tracking links between wiki pages. This is
to allow for broken link detection and "what links here" searches, among
other uses.
2019-10-23 21:36:48 -05:00