Fix #4601: Hide deleted pools by default in pool search.

* On /pools, hide deleted pools by default in HTML responses. Don't
  filter out deleted pools in API responses.

* API change: on /forum_topics, only hide deleted forum topics by
  default for HTML responses, not for API responses. Explicitly do
  https://danbooru.donmai.us/forum_topics.json?search[is_deleted]=false
  to filter out deleted topics.

* API change: on /tags, only hide empty tags by default for HTML
  responses, not for API responses. Explicitly do
  https://danbooru.donmai.us/tags.json?search[is_empty]=false to filter
  out empty tags.

* API change: on /pools, default to 20 posts per page for API responses,
  not 40.

* API change: add `search[is_empty]` param to /tags.json endpoint.
  `search[hide_empty]=true` is deprecated in favor of `search[is_empty]=false`.

* On /pools, add option to show/hide deleted pools in search form.

* Fix the /forum_topics page putting `search[order]=sticky&limit=40` in
  the URL when browsing past page 1.
This commit is contained in:
evazion
2021-09-29 05:28:21 -05:00
parent 4a525c7473
commit 2eb89a8354
8 changed files with 49 additions and 23 deletions

View File

@@ -12,7 +12,11 @@ class PoolsController < ApplicationController
end
def index
@pools = authorize Pool.paginated_search(params, count_pages: true)
if request.format.html?
@pools = authorize Pool.paginated_search(params, count_pages: true, defaults: { is_deleted: false })
else
@pools = authorize Pool.paginated_search(params, count_pages: true)
end
respond_with(@pools)
end