Commit Graph

8444 Commits

Author SHA1 Message Date
evazion
529fef7224 db: set timestamps to not null. 2019-11-15 22:44:22 -06:00
evazion
dad8114c97 db: fix index inconsistencies with production db. 2019-11-15 22:44:13 -06:00
evazion
0726e4346a migrations: fix old migration not removing posts.uploader_ip_addr index.
Bug: running migrations on a fresh database failed when we got to a
migration adding a posts.uploader_ip_addr index on 2019-11-11. It failed
because the index already existed.

The index already existed because we used to have it at one point, until
it was removed by another migration on 2015-01-20. This migration didn't
correctly remove the index though, because it tried to remove a
posts.source index first, which failed because this index didn't exist
(it probably existed only in production). This error was swallowed,
causing the migration to silently skip removing the posts.uploader_ip_addr
index, which eventually blew up when we tried to add the index again
later on.
2019-11-13 02:06:41 -06:00
evazion
378559ff47 autocomplete: make number of results configurable (partly).
Add `Danbooru.Autocomplete.MAX_RESULTS` param that controls the number
of results returned by autocomplete.

This does not work with tag autocomplete for Builders. Builder
autocomplete still needs to be refactored and unified with Member
autocomplete.

Also fix a bug in the /saved_searches/labels endpoint where the limit
param wasn't respected.
2019-11-13 01:47:41 -06:00
evazion
89c5ac73af autocomplete: switch to async/await. 2019-11-13 01:47:41 -06:00
evazion
2d1eabbe5f autocomplete: factor out clearing of menu bindings. 2019-11-13 01:47:37 -06:00
evazion
682aa220b8 /ip_addresses: add to sitemap; add IP info links. 2019-11-12 20:51:48 -06:00
evazion
f9881e5414 autocomplete: add saved search label autocomplete in more places. 2019-11-12 20:24:24 -06:00
evazion
cc98f3b7cc Update gems. 2019-11-12 19:05:32 -06:00
evazion
da8fbef5d6 /ip_addresses: add missing created_at, uploader_ip_addr indexes.
Add some missing indexes used by the /ip_addresses page.
2019-11-11 21:03:07 -06:00
evazion
73c02021a1 /ip_addresses: allow searching multiple IPs at once.
Fixes #4208. Allow searching for multiple IPs or user IDs. Separate
using spaces or commas.
2019-11-11 21:03:07 -06:00
evazion
68e1140b0d /ip_addresses: allow grouping IPs by subnet. 2019-11-11 21:03:07 -06:00
evazion
bf6bb94702 Add new IP address search page.
Add a new IP address search page at /ip_addresses. Replaces the old
search page at /moderator/ip_addrs.

On user profile pages, show the user's last known IP to mods. Also add
search links for finding other IPs or accounts associated with the user.

IP address search uses a big UNION ALL statement to merge IP addresses
across various tables into a single view. This makes searching easier,
but is known to timeout in certain cases.

Fixes #4207 (the new IP search page supports searching by subnet).
2019-11-11 21:03:07 -06:00
evazion
2aac42b112 Add show actions for note, artist, artist commentary versions.
Add these endpoints:

* /note_versions/1234
* /artist_versions/1234
* /artist_commentary_versions/1234

This is so the /ip_addresses listing can link to these endpoints.
2019-11-11 12:56:39 -06:00
evazion
9cf5b1f01c dtext: add dtext cheatsheet popup. 2019-11-10 14:48:17 -06:00
evazion
69f005a89c gems: remove cityhash gem.
This gem uses a native extension that requires a C++ compiler to build.
Removing this gem removes the need to have a C++ toolchain to install Danbooru.
2019-11-09 14:42:30 -06:00
evazion
76674597f1 Upgrade to Rails 6.0.1. 2019-11-06 21:57:32 -06:00
evazion
a92c24f093 wiki pages: add undelete link in navbar.
Also redirect back to the wiki page after deleting or undeleting it,
rather than redirecting to the index.
2019-11-06 21:57:32 -06:00
evazion
70b6525e69 wiki pages: fix error when force renaming wiki page.
Bug: force renaming a wiki page fails. Fix: use the wiki page id instead
of the title in the update action.
2019-11-06 21:56:21 -06:00
evazion
19549e2c12 css: fix overlong parent/child preview boxes on post show page.
Bug: if a post had a large number of child posts, the child post preview
box would expand beyond the width of the screen.

Setting `min-width: 0` makes the flexbox column shrink instead of
expand.
2019-11-05 20:58:07 -06:00
evazion
e031fb0400 users: use inline dtext for ban reason on profile page. 2019-11-05 19:15:44 -06:00
evazion
06d0ceb016 dmails: fix bug with parsing wiki links in email notifications.
Bug: sending a dmail containing a wiki link (ex: [[tagme]]) failed when
the recipient had email notifications turned on.

Cause: wiki links inside email notifications use absolute urls, which
the dtext postprocessor didn't parse correctly.
2019-11-05 19:10:41 -06:00
evazion
a653513e0a wiki pages: fix 404s for page titles containing dots.
Bug: links like these returned 404s:

* https://danbooru.donmai.us/wiki_pages/...
* https://danbooru.donmai.us/wiki_pages/.hack//
* https://danbooru.donmai.us/wiki_pages/ssss.gridman

Cause: by default, Rails uses dots in route segments to separate the id
from the format. For example, in /wiki_pages/ssss.gridman, the id is
parsed as "ssss" and the format is "gridman" (as if "gridman" were a
format like "json" or "xml").

We work around this by specifying the regex for the id param manually.
The trick here is to use a non-greedy match-all combined with a positive
lookahead to detect the extension but not include it in the match.
2019-11-05 15:14:08 -06:00
evazion
aeb5edaff6 Fix deadlocks while updating tags counts.
Sometimes uploads fail with this error:

    ActiveRecord::QueryCanceled - PG::QueryCanceled: ERROR: canceling
    statement due to statement timeout CONTEXT: while updating tuple
    (2808,110) in relation "tags"

This is caused by two uploads trying to update tag counts for the same
tags at the same time. The UPDATE statement doesn't guarantee the tags
will be updated in any particular order, which can cause deadlocks when
two UPDATEs try to update the same tags in a conflicting order. For
example, if one process tries to increment '1girl' and 'solo' (in that
order), while at the same time another process tries to increment 'solo'
and '1girl' (in that order), the result will be a deadlock.

The solution is to explicitly lock the tags in a consistent order before
the update statement.
2019-11-05 12:53:52 -06:00
evazion
a677c3ff1f /posts: fix link to wiki in wiki excerpt. 2019-11-04 18:53:08 -06:00
evazion
a418ed7281 post tooltips: use more compact timestamps.
* Use more compact timestamps in post tooltips ("39 minutes ago" -> "39m ago")
* Move timestamps to the right (after favcount + score).
* Switch favorite icon from star to heart.
2019-11-04 18:18:56 -06:00
evazion
c1939f78d6 artists: replace /artists/banned endpoint with simple search. 2019-11-04 17:15:02 -06:00
evazion
db01696e91 artist: fix /artists?name=<name> search. 2019-11-04 17:11:24 -06:00
evazion
d7233b3c39 implications: remove duplicate scopes.
These are already defined in tag_relationship.rb.
2019-11-04 16:50:52 -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
75ca53a9a1 autocomplete: fix underscore-to-space conversion in usernames.
Didn't handle names with multiple underscores correctly.
2019-11-04 15:45:07 -06:00
evazion
623de37b09 views: remove current user <meta> elements from <head>.
Previously deprecated. Use the data attributes on the <body> tag
instead.
2019-11-04 15:42: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
953de62d70 Update dtext gem. 2019-10-31 22:23:50 -05:00
evazion
9b9afff8c8 wiki pages: remove unused noredirect=1 from /wiki_pages index. 2019-10-31 19:06:39 -05: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
0ccfb3f5f6 wiki pages: fix error in new controller action. 2019-10-31 19:04:18 -05:00
evazion
9826776e66 Remove unused dtext/help template. 2019-10-31 19:04:18 -05:00
evazion
5422db1c3c Standardize links to wiki help pages.
* Fix inconsistencies in how wiki pages were linked.

* Link directly to the wiki instead of to a title search that is expected
  to redirect to the wiki.
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
91fd5e1bff js: add "ctrl+enter to submit form" shortcut.
Press Ctrl+Enter inside any text box to submit the form.
2019-10-31 00:27:43 -05:00
evazion
9cfb753c1b post tooltips: fix null deref when tooltips are disabled.
Fix an exception that is triggered by mousing out of a thumbnail when
tooltips are disabled. Caused by trying to access `qtip.cache` when
`qtip` is null.
2019-10-30 23:43:52 -05:00
evazion
bf841dcd44 gems: update gems. 2019-10-30 23:34:52 -05:00
evazion
2821559221 gems: drop term-ansicolor gem. 2019-10-30 23:32:28 -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
1f191d2cdf bans: list long bans as 'forever'. 2019-10-30 23:29:24 -05:00
evazion
64881d8840 bans: merge banner name + timestamp into one column. 2019-10-30 23:29:19 -05:00
evazion
f4b3d4e075 mod actions: reorganize index page.
* Add category column. Allow filtering by category.
* Merge user + timestamp into one column.
2019-10-30 23:29:13 -05:00
evazion
f865cd8aeb modqueue: bump "You haven't moderated any posts..." notice to 72 hours. 2019-10-30 10:49:14 -05:00