Commit Graph

1224 Commits

Author SHA1 Message Date
evazion
db01696e91 artist: fix /artists?name=<name> search. 2019-11-04 17:11:24 -06:00
evazion
90fef76121 artists: reorganize index page.
* Make other names searchable.
* Add post count and update timestamp.
* Add edit / delete / undelete links.
2019-11-04 16:45:19 -06:00
evazion
02b9acac9e wiki pages: replace show_or_new page with redirects.
* Redirect the show_or_new action to either the show page or the new
  page. Don't use show_or_new to render nonexistent wikis; do that in the
  regular show action instead.

* Make the show action return 404 for nonexistent wikis.
2019-11-04 15:35:47 -06:00
evazion
6e5e07022d Have single result searches go to the show pages for certain controllers #4204 2019-11-04 14:24:10 -06:00
evazion
3a908f84bb wiki pages: use names instead of ids in urls.
Switching to using wiki names in URLs instead of IDs:

* https://danbooru.donami.us/wiki_pages/vocaloid
* https://danbooru.donami.us/wiki_pages/hatsune_miku

ID numbers can still be used, but they redirect to the name instead:

* https://danbooru.donami.us/wiki_pages/11 (redirects to /wiki_pages/touhou).

Numeric tags are prefixed with '~' to distinguish them from IDs:

* https://danbooru.donami.us/wiki_pages/2019 (the wiki with id 2019)
* https://danbooru.donami.us/wiki_pages/~2019 (the wiki for the tag named 2019)

The tag names 'new' and 'search' are disallowed to prevent conflicts
with existing routes:

* https://danbooru.donami.us/wiki_pages/new
* https://danbooru.donami.us/wiki_pages/search
2019-10-31 19:04:18 -05:00
evazion
a8fc2ba508 wiki pages: fix redirects to exact matches during search.
Change wiki page search to redirect to exact matches only when using the
quick search bar. Fixes searches sometimes unexpectedly redirecting when
doing a regular (non-quick) search that happens to return a single result.

Also remove the logic that tries to expand the search when no results
are found. This will eventually be replaced with a smarter "did you mean?"
search.
2019-10-31 19:04:18 -05:00
evazion
55a2c6de2b user feedbacks: reorganize index page.
* Move search form to index page instead of a separate page.
* Merge creator + timestamp into one column.
* Add category column.
* Fix N+1 query issue.
2019-10-30 23:29:24 -05:00
evazion
f865cd8aeb modqueue: bump "You haven't moderated any posts..." notice to 72 hours. 2019-10-30 10:49:14 -05:00
evazion
6424a4de74 Do full page counts on small index pages.
Normally we skip doing page counts on index pages when there aren't any
search filters. This is on the assumption that most index pages have
more than 1000 pages (20,000 results), so it's not worth counting them
exactly. This isn't always true, so here we turn on full counts on
certain index pages known to be small.
2019-10-28 15:18:54 -05:00
evazion
fd4a9d4d30 post/comment/forum votes: add vote counts to profile pages.
* Add post/comment/forum vote counts to user profiles.
* Show uploaders on post votes index and allow searching by uploader.
* Show forum posters on forum votes index and allow searching by poster.
* Add unvote link to forum votes index.
* Only show unvote links to current user.
2019-10-28 14:46:16 -05:00
evazion
d3165f78aa comment votes: add index page. 2019-10-28 14:12:40 -05:00
evazion
f4376fc7a3 post votes: add index page. 2019-10-28 03:21:18 -05:00
evazion
dfbf4f3f0a Remove single alias/implication requests.
* Remove the single alias and implication request forms. From now
  on, bulk update requests are the only way to request aliases or
  implications.

* Remove the forum topic ID field from the bulk update request form.
  Instead, to attach a BUR to an existing topic you go to the topic then
  you click "Request alias/implication" at the top of the page.

* Update the bulk update request form to give better examples for the
  script format and to explain the difference between aliases and
  implications.
2019-10-28 01:36:28 -05:00
evazion
b5a40aa233 bulk update requests: list upvotes/downvotes on index page. 2019-10-28 01:06:23 -05:00
evazion
0e159960a2 forum post votes: add index page. 2019-10-28 01:06:23 -05:00
evazion
a0b6c9b116 wiki pages: drop creator and updater fields.
Drop the creator_id and updater_id fields from wiki pages. These fields
had several issues:

* The creator_id field was inconsistent with the wiki_page_versions
  table. Apparently during the migration to Danbooru 2 in 2012-2013 the
  creator_id field got reset to whoever last updated the wiki at that
  point in time.

* Saving a wiki would set the updater_id even when nothing actually
  changed. This also caused the updated_at timestamp to get bumped.
  Because of this, anything that saved a wiki, including things like
  creating aliases or implications, would bump the updater_id and
  updated_at even though the wiki didn't actually change. This meant
  these fields weren't consistent with the wiki_page_versions history.

Changes:

* Remove `creator_name` field from the /wiki_pages.json API.
* Remove creator name search option from /wiki_pages/search.
2019-10-24 19:48:30 -05:00
evazion
812cabfc07 dtext links: add basic index page. 2019-10-23 21:36:48 -05:00
evazion
8fbf989e8e /iqdb_queries: support bare image_url param. 2019-10-23 10:46:36 -05:00
evazion
d2c6d6d17b iqdb: hide low similarity results behind "show" link. 2019-10-16 23:53:09 -05:00
evazion
ae521e600e iqdb: proxy iqdb searches through danbooru.
Previously the search form on the /iqdb_queries page submitted directly
to the iqdb service (karasuma.donmai.us), which redirected back to
Danbooru with the search results.

This was different than API requests, which submitted to
/iqdb_queries.json which proxied the call to iqdb through Danbooru.
Because of this, searches on the /iqdb_queries page had different
behavior than API requests. Things like filesize limits and referrer
spoofing were handled differently.

Now searches on the /iqdb_queries page submit directly to Danbooru. This
is simpler and it means that API requests and HTML requests have the
same behavior.
2019-10-14 21:16:04 -05:00
evazion
fa37b1edcd iqdb: lower similarity cutoff, return more results (fix #4190).
* Change cutoffs on upload page to max 5 results, min. 20% similarity.
* Change cutoffs on standalone /iqdb_queries page to max 20 results, min. 0% similarity.
* /iqdb_queries.json: add `limit` and `similarity` params to change default cutoffs.
2019-10-14 21:16:04 -05:00
evazion
ca54e2d67b iqdb: simplify ajax call.
Also add support for .xml responses to /iqdb_queries.
2019-10-14 21:16:04 -05:00
evazion
30091b989d /pools: fix pagination typo. 2019-10-08 00:50:27 -05:00
evazion
3955c3fc8d /forum_topics: fix default limit being ignored. 2019-10-08 00:00:16 -05:00
evazion
cc4e39b88b sessions: raise exception on failed login attempts.
* Allow both xml and json authentication in sessions controller.

* Raise an exception if a login attempt fails so that a) we return a
  proper error for json/xml requests and b) failed login attempts get
  reported to NewRelic (for monitoring abuse).
2019-10-07 22:35:37 -05:00
evazion
a5ab25d0ba pagination: avoid counting pages outside searches.
Replace this common pattern in controllers:

    @tags = Tag.search(search_params).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])

with this:

    @tags = Tag.paginated_search(params)

`search_count` is used to skip doing a full page count when we're not
doing a search (on the assumption that the number of results will be
high when not constrained by a search). We didn't do this consistently
though. Refactor to do this in every controller.
2019-10-07 22:02:03 -05:00
evazion
93dd952949 pagination: refactor to avoid counting pages in API.
Previously the page-based (numbered) paginator would always count the
total_pages, even in API calls when it wasn't needed. This could be very
slow in some cases. Refactor so that total_pages isn't calculated unless
it's called.

While we're at it, refactor to condense all the sequential vs. numbered
pagination logic into one module. This incidentally fixes a couple more
bugs:

* "page=b0" returned all pages rather than nothing.
* Bad parameters like "page=blaha123" and "page=a123blah" were accepted.
2019-10-07 22:01:37 -05:00
r888888888
62a1aeabce expose user's api key as api_token field on sessions 2019-10-07 13:54:52 -07:00
evazion
c66f7c4626 post/pool versions: fix database timeouts not being set.
Bug: database timeouts were set only on the main database, not on the
post and pool versions database, so users effectively had an unlimited
timeout when dealing with these things.
2019-09-30 00:58:34 -05:00
evazion
fc3441606e forum posts, comments: make timestamps into permalinks.
Make the timestamp beneath the username on forum posts into a permalink
that links to the post in full context of the thread. For comments, make
the timestamp link to the comment in full context of the post.

* Make the timestamp in forum posts link to /forum_posts/123.
* Make the timestamp in comments link to /posts/456#comment_123.
* Make /forum_posts/123 redirect to /forum_topics/456#forum_post_123.
* Make /comments/123 redirect to /posts/456#comment_123.
* Remove the "ID: ###" and "Permalink" fields from forum posts.
2019-09-29 15:57:15 -05:00
evazion
960e5d4ae0 views: factor out sidebar layout template.
* Factor out common sidebar layout template.
* Convert wiki pages and posts to use this template.
* Add data-layout attribute to <body> element indicating the current layout.
2019-09-28 17:50:10 -05:00
evazion
a39b67b901 Remove mod-only user revert system (#4178).
The mass undo system from #4178 replaces this system.

Followup to f2dccf8cf.
2019-09-27 21:48:49 -05:00
evazion
f2dccf8cf1 Remove mod-only bulk revert system (#4178).
The mass undo system added in #4178 is a replacement for the mod-only
bulk revert system.
2019-09-27 21:12:53 -05:00
evazion
1341dbb262 Remove post changes report.
This was a mod-only report that used Google BigQuery to search post
versions by tag. 2b4ee0ee8 allows all users to search post versions by
tag, so this report is no longer necessary.
2019-09-27 21:12:53 -05:00
evazion
d29bbbbd71 Fix #4178: add ability to mass undo tag edits.
Adds checkboxes to the /post_versions index allowing you to select and
undo multiple versions at once.
2019-09-27 21:02:32 -05:00
evazion
eff6480699 user name changes: require confirmation of new name. 2019-09-25 22:16:06 -05:00
evazion
c710aa3ffb Fix #4177: Allow all users to change their username. 2019-09-25 21:43:01 -05:00
evazion
3b63f94968 user name changes: remove unused reason, status fields.
Remove all infrastructure around approving or rejecting user name
changes. Name changes haven't been moderated for several years.

* Remove status, approver_id, change_reason, and rejection_reason fields.
* Remove approve and reject controller actions.
2019-09-25 21:43:01 -05:00
evazion
bc34fb16a4 tags: automatically fix incorrect tag counts during maintenance.
* Automatically fix all tags with incorrect counts during daily
  maintenance (previously only tags with negative counts were fixed).
* Log fixed tags to NewRelic.
* Remove the ability to manually fix tag counts with the "Fix" button on
  the /tags listing. This is no longer necessary now that tags are
  fixed automatically.
2019-09-25 17:57:11 -05:00
evazion
4e4c4d627e saved searches: remove option to disable saved searches.
Remove `SavedSearch.enabled?` checks. There's no need to make saved
searches optional, since Redis is now required to run Danbooru.
2019-09-22 23:04:22 -05:00
evazion
9839f97f9e Fix #4176: Ordering favorite groups errors out. 2019-09-22 15:24:23 -05:00
evazion
bf51d68f15 users: add dark mode account setting (fix #4158). 2019-09-19 13:20:06 -05:00
evazion
312adb772d views: refactor post flag and appeal reasons.
* Prefer partials over helpers.
* Add css classes to flag/appeal reason lists.
* Wrap dtext in span.prose container.
2019-09-18 03:20:26 -05:00
evazion
c85bbbf8c2 comments: fixup "show hidden comments" link.
Fixup for 896f144eb.
2019-09-17 00:28:40 -05:00
evazion
f8dd3eb72b Fix #4165: Add mechanism to test error responses.
https://danbooru.donmai.us/posts.json?error=500&message=testing
2019-09-12 22:37:32 -05:00
evazion
a5043245b6 views: migrate related tags, mass edits to simple form. 2019-09-10 21:51:14 -05:00
evazion
896f144eb6 views: refactor quick search forms. 2019-09-10 21:10:09 -05:00
evazion
a1b48f5e3f views: migrate search forms to use simple form.
Migrate various forms to be built using simple form instead of raw html.
Also adds autocomplete="off" to these forms (#4162).
2019-09-10 14:33:18 -05:00
evazion
347aa4b835 Add error pages for tag limit and pagination errors. 2019-09-09 17:43:30 -05:00
evazion
62b89e1f9a user upgrades: make upgrade page visible to logged out users. 2019-09-09 17:42:46 -05:00