Commit Graph

8460 Commits

Author SHA1 Message Date
evazion
91d1817abf artists: don't return domains in /artists/{id}.xml.
Don't return the `domains` field in /artists/{id}.{json,xml}. Fixes a
failure in /artists/{id}.xml:

    https://danbooru.donmai.us/artists/156646.xml

    <result success="false">
        undefined method `domains' for #<ArtistUrl:0x00005566dd340af0> Did you mean? DomainName
    </result>

`to_xml` passes down the `methods` param to all nested models, which
doesn't work.
2019-11-17 18:24:06 -06:00
evazion
320ff01e07 login: remove 'remember' checkbox; make session cookies permanent.
Remove the "Remember" checkbox from the login page. Make session cookies
permanent instead. Phase out legacy `user_name` and `password_hash` cookies.

Previously a user's session cookies would be cleared whenever they
closed their browser window, which would log them out of the site. To
work around this, when the "Remember" box was checked on the login page
(which it was by default), the user's name and password hash (!) would
be stored in separate permanent cookies, which would be used to
automatically log the user back in when their session cookies were
cleared. We can avoid all of this just by making the session cookies
themselves permanent.
2019-11-17 17:50:23 -06:00
evazion
9b893db640 autocomplete: fixup uses of tag_aliases.post_count.
Fixup for 64728c89d.
2019-11-17 16:03:56 -06:00
evazion
d1689f895e tests: fixup /artists/banned endpoint test. 2019-11-17 14:41:09 -06:00
evazion
6e403fddb6 alias/implications: fixup uses of creator_ip_addr.
Fixup for a2ea2a65a. Use 127.0.0.1 rather than the creator's original IP
for any edits performed as part of an alias or implication.
2019-11-17 14:39:46 -06:00
evazion
e29d7162a4 autocomplete: fixup limit param.
Fixiup for 378559ff4. Fix case when limit param is nil.
2019-11-17 14:39:46 -06:00
evazion
64728c89d8 db: remove tag_aliases.post_count column.
This was only used in autocomplete, but it was unnecessary here because
we could already get the post count from the tags table.
2019-11-17 14:39:41 -06:00
evazion
a2ea2a65a1 db: drop IP addresses from certain tables.
Don't track IP addresses for post appeals, post flags, tag aliases, tag
implications, or user feedbacks. These things are already tightly
limited. We don't need IPs from them to detect sockpuppets.
2019-11-17 02:45:28 -06:00
evazion
72f17fd1de Fix #3534: Remove Janitor Trials. 2019-11-17 02:10:24 -06:00
evazion
1ae971269c db: drop tag subscriptions table. 2019-11-17 01:52:36 -06:00
evazion
fedb525305 notes: add fallback font for comic sans (#4212). 2019-11-16 22:43:16 -06:00
evazion
364ecfe68f db: drop unused columns from users table.
Note that the password_hash column was replaced by bcrypt_password_hash
in 2013, but the old password_hash column was never dropped.
2019-11-16 19:34:30 -06:00
evazion
90713ef94c db: fix more inconsistencies between structure.sql and production db.
Fix various cases where db/structure.sql either didn't match the
production db or didn't match the db structure produced when running
migrations from a fresh install.
2019-11-16 16:35:04 -06:00
evazion
9248266659 Fix #4213: Empty Last IP link. 2019-11-16 10:39:57 -06:00
evazion
13f26c81d8 Remove unused files. 2019-11-15 23:59:56 -06:00
evazion
3746c9890a db: resync db/structure.sql. 2019-11-15 23:36:31 -06:00
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