Commit Graph
100 Commits
Author SHA1 Message Date
evazion 89b523bdae Fix #3480: NoMethodError error when adding artist tag to post. 2017-12-30 16:07:52 -06:00
evazion 3e936748c0 Fix #3468: Approval queue should not show one's own uploads or previous approvals. 2017-12-28 19:36:37 -06:00
evazion 1ca2497015 Fix #3474: Spurious email notifications. 2017-12-28 18:50:08 -06:00
evazion 857fa24697 Fix #3473: Validation warnings for no artist/copyright are still shown on upload failure. 2017-12-28 18:19:28 -06:00
evazion d8eef6ef2b Fix #1563: Warn users attempting to upload with very few tags. 2017-12-27 15:04:00 -06:00
evazion ad74d9e75a Fix #3464: CurrentUser.ip_addr isn't set for anonymous users. 2017-12-27 13:34:20 -06:00
evazion 1fc2284874 /users/new: show error message when account signup fails. 2017-12-27 13:34:20 -06:00
evazion 32ac09ee48 Add test for registering sock puppet accounts. 2017-12-27 13:33:57 -06:00
evazion 48b67967b5 Fix #3457: Timeout when fetching source data from NicoSeiga. 2017-12-27 13:08:14 -06:00
evazion e34754c65c Possible fix for #3460: Timeout in update_last_ip_addr.
Set the user's statement timeout as soon as possible, before updating
anything in the database.
2017-12-27 12:42:11 -06:00
evazion 952b5f9245 Fix bogus artist finder matches for http://www.nicovideo.jp/user/1234. 2017-12-26 14:31:42 -06:00
evazion 86f1ec5919 Fix #3459: Batch Bookmarklet for Artstation returns wrong results. 2017-12-26 14:05:41 -06:00
evazion 0d69c03249 Fix "undefined method `is_builder?' for nil:NilClass" in static/error.html.erb.
`CurrentUser.user` may be nil if an exception is raised before it's
initialized.
2017-12-23 18:27:04 -06:00
evazion 5f1b7da95d Fix "RuntimeError: can't modify frozen String" in static/error.html.erb.
Fixes a frequently occurring error in New Relic.
2017-12-23 18:23:41 -06:00
evazion 91592b2f18 Fix #3448: Lower the limit for tag category changes.
Also allow admins to bypass all restrictions.
2017-12-23 13:44:45 -06:00
evazion 2385933e56 tags: fix /tags/1234/edit not enforcing correct category change restrictions. 2017-12-23 13:41:18 -06:00
evazion 19bda2056c tags: update category cache whenever category changes.
Do `update_category_cache_for_all` in a callback instead of calling it
manually everywhere.
2017-12-23 13:07:23 -06:00
evazion 265377bdbb Fix #3450: Aliased tags show up under translated tags.
Resolves aliases in translated tags. For example, say we lookup `遠坂凛`
and find `tohsaka_rin` and `toosaka_rin`. We apply aliases so that
`tohsaka_rin` becomes `toosaka_rin`, which is then returned as the only
translated tag.
2017-12-23 12:27:58 -06:00
evazion 6243cc8d48 Fix invalid routes for /posts, /explore/posts.
Fixes these invalid routes:

* GET http://danbooru.donmai.us/posts/new
* GET http://danbooru.donmai.us/posts/1234/edit
* POST http://danbooru.donmai.us/posts
* DELETE http://danbooru.donmai.us/posts
* GET http://danbooru.donmai.us/explore/posts
2017-12-23 11:31:12 -06:00
evazion 806513836b Fix failbooru in /users/custom_style.css when custom_style is nil.
http://danbooru.donmai.us/users/custom_style.css failed when manually
requested by anonymous users, or by users who didn't have a style set.
2017-12-23 11:11:50 -06:00
evazion 20b84578a2 Fix "The action 'show' could not be found for FavoritesController"
Fixes an exception on "/favorites/1234" requests.
2017-12-23 00:56:40 -06:00
evazion 5975152ddc Fix double render error in /blah.js. 2017-12-23 00:45:07 -06:00
evazion fcec99405c Fix failure in rake db:migrate on fresh install (#3443).
Create the DanbooruBot account in db/seeds.rb instead of in an
initializer. Move the old db/seeds.rb to db/populate.rb.

Fixes a bug introduced in e2eb45a. Creating DanbooruBot in an
initializer was wrong because in a fresh install the users table doesn't
exist yet. This caused `rake db:migrate` to fail.
2017-12-21 12:08:08 -06:00
evazion 8c44789fbc Fix #3440: Implications aren't applied to automatic tags.
Apply implications after adding automatic tags.
2017-12-19 14:37:12 -06:00
evazion b711566c14 Fix #3438: Thumbnails on user profiles don't respect safe mode. 2017-12-19 13:58:41 -06:00
evazion 4b5129d447 lib/tasks/images.rake: fix bad ref to danbooru_image_resizer.
Fixup for efeaad25.
2017-12-18 18:08:41 -06:00
evazion fa941e9480 /post_replacements: allow updating image metadata in past replacements. 2017-12-18 18:03:03 -06:00
evazion e6acd6f2d6 /post_replacements: list old and new md5 and image sizes. 2017-12-18 18:03:03 -06:00
evazion eede2f0752 Fix #3324: Incorporate replacement comment info in the replacement history. 2017-12-18 18:02:43 -06:00
evazion efeaad25ca Move lib/danbooru, lib/danbooru_image_resizer to app/logical. 2017-12-18 12:07:52 -06:00
evazion 859fe99a80 Fix #2696: Bogus results on non-matching URL searches for Artists 2017-12-17 21:00:34 -06:00
evazion 2a876991da Accept search[created_at] and search[updated_at] params in all controllers. 2017-12-17 17:37:26 -06:00
evazion 0ca726802f Fix #3430: Accept the search[id] param in all controllers.
* Allow every controller to take the `search[id]` param.

* Parse the `search[id]` param the same way that the `id:<N>` metatag is
  parsed. So `search[id]=1,2,3`, `search[id]=<42`, `search[id]=1..10`, for
  example, are all accepted.
2017-12-17 17:36:52 -06:00
evazion 86936f7200 Artist#find_all_by_url: refactor hardcoded bogus urls to blacklist. 2017-12-17 14:14:21 -06:00
evazion 49577e3fac /static/bookmarklet: add note using bookmarklet on Twitter with Firefox.
In Firefox, to use the bookmarklet on Twitter you must install version
1.1.3 of the Bookmarklets Context Menu addon. See https://danbooru.donmai.us/forum_topics/14794.
2017-12-16 12:59:02 -06:00
evazion 002b5e385a Autoban dmail spambots (#3408).
If a user sends spam to more than 10 users within a 24 hour window,
automatically ban them for 3 days.
2017-12-15 19:14:27 -06:00
evazion e2eb45a5a3 Auto-promote DanbooruBot to Mod. Auto-create DanbooruBot if it doesn't exist. 2017-12-15 18:54:18 -06:00
evazion b48211cd4a dmails: only spam check recipient's copy of the dmail.
Each dmail creates two copies, one for the sender and one for the
receiver. Only spam check the receiver's copy.

Prevents senders from being able to tell when their messages are being
spam filtered.
2017-12-15 18:54:18 -06:00
evazion 3ce8f6e7df /wiki_pages/show_or_new: show post count in navbar if tag exists (#3410).
649969156 hid the post count in the navbar on /wiki_pages/new, but that
also hid the count for /wiki_pages/show_or_new?title=medium_hair, which
was wrong. Show the count when the tag exists.
2017-12-15 11:54:56 -06:00
evazion d2df35092b /user_feedbacks: display "Updated N minutes ago" on edited feedbacks (#3423). 2017-12-15 11:16:24 -06:00
evazion 03cecf097e Factor out duplicated p.info CSS.
`p.info` is used to render "Updated by so-and-so 5 minutes ago" messages as fine print.
2017-12-15 11:14:12 -06:00
evazion 4c39783d28 Fix #3424: /iqdb_queries.json fails for certain urls.
Fix the HTML page -> image URL download rewrite strategy failing for
https://lohas.nicoseiga.jp/thumb/${id}i URLs.
2017-12-15 10:16:06 -06:00
evazion 5819afced7 Fix #3412: Mass updates incorrectly move saved searches. 2017-12-06 14:46:12 -06:00
evazion d6d73404a9 Apply aliases to characters in <character>_(cosplay) tags (#3409). 2017-12-06 12:47:27 -06:00
evazion 131c0109d4 Address #3415: og:image meta tags can point to video files. 2017-12-06 09:47:57 -06:00
evazion acd49be4cc Fix #3419: Deleting a post doesn't clear parent's "parent" status.
Bug: when deleting a child post and the "Move favorites to parent?" option is
set, the parent's has_active_children flag is not cleared.

`give_favorites_to_parent` moves the votes, and moving the votes has the
side effect of reloading the post (to get the new score). But reloading
the post wipes out the is_deleted_changed? flag, which is used by `update_parent_on_save`.

Fix: update the `is_deleted` flag *before* moving favorites, so that the
`update_parent_on_save` callback runs before `give_favorite_to_parent` runs.
2017-12-05 19:35:15 -06:00
evazion feb3ec0750 Fix #3417: Deleting a user's comment credits the change to them. 2017-12-02 19:41:37 -06:00
evazion 8d8a2f9c1e Make recaptcha optional on signup page. 2017-11-29 18:09:37 -06:00
evazion 2000719227 /wiki_pages: get navbar post count from tags table.
Post.fast_count is dependent on the current user's settings. This meant
that tag counts in wiki pages could be different from the tag counts
displayed in tag lists.
2017-11-29 13:12:53 -06:00
evazion 649969156e /wiki_pages: don't show post count in navbar when creating new wikis. 2017-11-29 12:56:58 -06:00
evazion 3c6a613964 Fix #3410: Unable to create a new wiki page.
Fix `Post.fast_count(nil)` failing when the user had the "safe mode" or
"deleted post filter" options turned on.
2017-11-29 12:34:07 -06:00
evazion dd8e3bbb94 tags: add trigram index on tag names. 2017-11-27 15:21:19 -06:00
evazion 44f4befa5a autocomplete: add automatic typo correction.
If normal autocomplete fails to find any results, try doing a
fuzzy name search instead. This will correct simple typos.
2017-11-27 15:21:19 -06:00
evazion f4d279771f /tags: add fuzzy name search params (search[fuzzy_name_matches], search[order]=similarity). 2017-11-27 15:21:19 -06:00
evazion 4939c0345a Fix test failures when removing posts from deleted pools.
These tests failed because removing posts from deleted pools is now
Builder-only.
2017-11-26 18:10:08 -06:00
evazion a7566ae851 post_view_count_service_test.rb: fix test failure. 2017-11-26 16:17:21 -06:00
evazion 255082d3b5 tumblr: fix test failure. 2017-11-26 15:37:51 -06:00
evazion 1c5c3b5f9f Include paginator extensions in ApplicationRecord. 2017-11-26 15:34:44 -06:00
evazion ec6d553fa6 Move execute_sql / select_value_sql etc to ApplicationRecord. 2017-11-26 13:57:52 -06:00
evazion 45cecff1a6 Move with_timeout / without_timeout to ApplicationRecord. 2017-11-26 13:57:52 -06:00
evazion 5b89f56c2e Move PostgresExtensions to ApplicationRecord. 2017-11-26 13:57:51 -06:00
evazion 8a0f600ac2 uploads: fix rating:S not being recognized by rating validator. 2017-11-26 11:54:13 -06:00
evazion 6d9708a22e posts: don't warn about missing artist tags for official_art. 2017-11-26 11:43:46 -06:00
evazion 80e115b600 favgroups: fix race condition when adding posts to favgroups.
Adding or removing a post id to a favgroup's post_ids string is
non-atomic. Lock it to prevent simultaneous updates to the same favgroup
from clobbering each other.

Same bug as #3091.
2017-11-26 11:02:39 -06:00
evazion 810b6b8b99 Fix #3039: Test failures under ruby 2.4. 2017-11-25 21:52:32 -06:00
evazion 127e4e385b Fix dmail failures when akismet isn't configured. 2017-11-25 21:46:32 -06:00
evazion bc3e2438d9 posts: add tests for warning validations. 2017-11-25 17:03:33 -06:00
evazion cc1f8ab9ed posts: warn when a tag cannot be removed due to implications / automatic tags. 2017-11-25 17:03:33 -06:00
evazion 94fa835733 posts: warn when post from known source is missing an artist tag. 2017-11-25 17:03:33 -06:00
evazion 4cd372296d posts: warn when post is missing copyright tags. 2017-11-25 17:03:33 -06:00
evazion d571efd703 posts: warn when adding artist tag with no artist entry. 2017-11-25 17:03:33 -06:00
evazion 963eacd849 posts: warn when adding newly created tags. 2017-11-25 17:03:32 -06:00
evazion 07a4bdcb21 posts: display validation warnings in flash notice. 2017-11-25 17:03:32 -06:00
evazion aeb24b6253 Fix "Similarity: %98" -> "Similarity: 98%". 2017-11-25 16:50:12 -06:00
evazion b62b16b5a2 Fix #3398: Show "(deleted)" next to topics in forum searches. 2017-11-24 15:58:45 -06:00
evazion 0b5ed163fe Fix #3395: fix pixiv API exception when uploading bad pixiv id images.
Fixes an exception when attempting to upload a Pixiv image from a
deleted work. The download strategy tries to fetch the source data in
the course of rewriting the URL, which fails if the work has been
deleted from Pixiv.

Raise a BadIDError and leave the URL as-is (don't rewrite it).
2017-11-21 14:40:39 -06:00
evazion 183a7e07e3 pixiv: fix failbooru when uploading bad pixiv id posts.
Fixes an "incompatible character encodings: UTF-8 and ASCII-8BIT"
exception when uploading a deleted Pixiv post.

Caused by the Pixiv API error message not having the encoding set to UTF-8.
2017-11-21 14:11:59 -06:00
evazion 5ba63733d3 download/pixiv_test.rb: fix broken pixiv download tests.
This post was deleted:

  http://www.pixiv.net/member_illust.php?mode=medium&illust_id=46304614

Switch to this instead:

  http://www.pixiv.net/member_illust.php?mode=medium&illust_id=46324488
2017-11-21 13:48:07 -06:00
evazion a14c492020 Fix #3396: Pixiv novel cover IDs are parsed incorrectly. 2017-11-21 13:03:03 -06:00
evazion f8581c8113 Fix #3321: HTML tags not converted in artist commentaries. 2017-11-21 02:42:49 -06:00
evazion b3a9cd6c06 Fix Post.fast_count("pool:1537") == 0 (fixup 134958d1).
Fixup for a bug in 134958d1. `Post.fast_count("pool:1537")` still
returned zero because `Tag.is_simple_tag?` incorrectly parsed
"pool:1537" as a simple tag, so Post.fast_count still looked for it in
the tags table and found the empty "pool:1537" tag.
2017-11-20 21:21:36 -06:00
evazion df7648b581 Fix #3392: Add safe mode account setting. 2017-11-20 18:59:53 -06:00
evazion 134958d137 Fix #3390: Searching certain metatags results in an empty paginator
Fixes Post#get_count_from_cache to only lookup the count in the tags
table when the search is for a single "simple" tag.

Check memcache when the search is not a simple tag:

* multi-tag searches (touhou rating:s)
* single metatag searches (rating:s, source:"foo bar")
* negated tags (-touhou)
* wildcard tags (*touhou*)
* or searches (~touhou)
2017-11-20 14:41:02 -06:00
evazion 7034a96048 Purge invalid gentags from tags table (#3390).
Purges gentags with invalid names from the tags table. Addresses #3390
(Searching certain metatags results in an empty paginator) by removing
metatags from the tags table.
2017-11-20 12:47:30 -06:00
evazion 9b887c3c3a Fix #3387: Safebooru: Two tag searches fail for members.
Makes the `rating:s` and `-status:deleted` tags not count against the
tag limit.
2017-11-19 20:58:22 -06:00
evazion 40d0751e83 Fix NoStrategyError during artist url normalization (#3382).
Fixes a bug from 9a3824a. When an artist entry is saved, `ArtistUrl.normalize`
is called on every URL, which calls `Sources::Site.new(url)`. This
raised NoStrategyError when an artist entry contained URLs that weren't
recognized by any strategy.

This also caused `Fetch source data` to fail in certain cases when it
attempted to find the artist.
2017-11-19 10:49:30 -06:00
evazion fa22e419af Fix #3385: Bookmarklet sets wrong source for Tumblr posts
Due to missing || operators, for Pawoo/Tumblr/Artstation uploads the
source wasn't changed from the direct image URL to the html page URL
after upload.
2017-11-18 15:44:16 -06:00
evazion 5837b74de4 tumblr: fix exception when fetching source data.
Fixes an `undefined method `gsub' for nil:NilClass` exception when fetching source
data for this url:

* /uploads/new?url=https%3A%2F%2Fuiti-ukumo.tumblr.com%2Fpost%2F156157443158%2F2016-12

Bug introduced in 3c524aa5: `url` wasn't initialized due to `@url = url`
being removed from Sources::Site#initialize.
2017-11-18 15:44:09 -06:00
evazion f896c24d37 tumblr: fail more gracefully if API key is not configured. 2017-11-18 13:53:11 -06:00
evazion 2422ce036c tumblr_test.rb: fix test failures. 2017-11-18 13:52:30 -06:00
evazion 22c9cfcec5 Fix #3384: Fetch commentary not creating fully formed textile links 2017-11-18 13:02:50 -06:00
evazion 6b8bc318b5 deviantart_test.rb: fix test failures. 2017-11-18 13:00:18 -06:00
evazion 05dea309b2 Fix search box rendering above tag edit dialog box (fix #3383). 2017-11-18 09:38:00 -06:00
evazion 26679dd7ab Fix #3323: Exclude post replacements from Mod Actions. 2017-11-17 13:21:36 -06:00
evazion 93767c3023 Fix post replacement test failure. 2017-11-17 13:21:35 -06:00
evazion 3df404dbd9 Fix #3380: Change category on Bulk Update Requests are broken. 2017-11-17 12:19:39 -06:00
evazion 07d20f7cf0 Add test for category <tag> -> type bulk update requests. 2017-11-17 12:15:38 -06:00
evazion eeb41d2ffd twitter: get status id from referer url if not in direct url. 2017-11-16 13:29:58 -06:00
evazion f633222ef0 twitter: test fetching source data from direct image with referer. 2017-11-16 13:29:58 -06:00
evazion 3cf753c540 Fix forum_post_id not being saved by alias/implication requests.
`forum_post_id` failed to save due to mass-assignment protection.

This caused alias approval messages ("The tag alias foo -> bar (forum #1234) has been approved.")
to not include the "(forum #1234)" bit because the forum id was nil.
2017-11-15 19:12:13 -06:00