Commit Graph
100 Commits
Author SHA1 Message Date
evazion feaad0bbd0 nginx.conf: fix inconsistent client_max_body_size. 2018-02-27 18:22:37 -06:00
evazion 5ad06a4034 Fix #3552: Upload filesize limits can be bypassed.
* Change `http_get_streaming` to write the output file directly,
  instead of taking a callback.

* Track the filesize as the download progresses and abort when it
  exceeds the limit.

* Don't save the Content-Type (it's not used anywhere).
2018-02-27 18:22:34 -06:00
evazion 78aba1c5b1 Fix #3554: approving BUR with nil forum_post_id doesn't update forum.
Wrap `approve!` and `reject!` in transactions so that if there's an
error in approving or rejecting a BUR, it leaves the BUR's status
unchanged instead of updating the BUR but not updating the forum.
2018-02-24 15:04:57 -06:00
evazion 2b8767d7f4 BulkUpdateRequest#approve!: don't swallow exceptions.
Rescue `AliasAndImplicationImporter::Error` instead of `Exception`.
2018-02-24 14:37:02 -06:00
evazion c9eee7e4d4 Fix #3528: Prevent CloudFlare from altering images. 2018-02-24 13:42:00 -06:00
evazion b859a1f714 downloads: add tests for untested sites. 2018-02-24 13:42:00 -06:00
evazion e48b75c261 downloads: rewrite url in download!, not http_get_streaming.
Refactor Downloads::File#http_get_streaming to just download the given
url, not rewrite it.

Don't clobber @source or @data in `#size` either.
2018-02-24 11:23:27 -06:00
evazion 7157251657 Upgrade to jquery-2.2.4 (#3548). 2018-02-24 10:43:12 -06:00
evazion 3fefb73e90 Fix #3561: Tumblr: support answer posts. 2018-02-24 10:31:59 -06:00
evazion c482175050 Fix #3558: Autocomplete: negated metatags aren't completed.
Fix Danbooru.Autocomplete.parse_query to strip prefixes off of
metatags.
2018-02-19 23:57:46 -06:00
evazion d8e195d168 autocomplete: unify autocomplete options.
Use a single set of default options so that autocomplete behaves
the same way everywhere.
2018-02-18 19:22:46 -06:00
evazion 4754daf594 autocomplete: unify menu item rendering.
* Use `Danbooru.Autocomplete.render_item` for all menu item rendering.
  Fixes usernames not being colorized when completing mentions, and post
  counts not being shown when completing pools on the /pools page.

* Make the /pools page autocomplete pool names the same way that the
  pool:<name> metatag does. Previously autocomplete on the /pools page
  listed most recently updated pools first; now it lists largest pools first.
2018-02-18 19:22:46 -06:00
evazion 962842815d autocomplete: move artist/pool/wiki autocompletion to autocomplete.js.
* Move all autocomplete code to autocomplete.js.

* Mark autocompleted fields with `data-autocomplete="<type>"` attributes,
  instead of hardcoding input field IDs in the javascript.
2018-02-18 19:22:17 -06:00
evazion a058a77c07 ApplicationHelper#search_field: accept html attributes on <input> field.
Rewrite `search_field` to allow setting `data-*` attributes on the <input> field.
2018-02-18 18:34:18 -06:00
evazion 4bc5cc8ccd bulk update requests: allow admins to edit forum topic/post ids (#3554). 2018-02-18 13:08:53 -06:00
evazion f07aa1b170 bulk update requests: convert to strong params. 2018-02-18 12:12:12 -06:00
evazion 263fd0eef1 Fix #3528: Prevent CloudFlare from altering images. 2018-02-17 11:43:27 -06:00
evazion 1eff41a6f9 downloads: rewrite url in download!, not http_get_streaming.
Refactor Downloads::File#http_get_streaming to just download the given
url, not rewrite it.

Don't clobber @source or @data in `#size` either.
2018-02-17 11:11:50 -06:00
evazion 9aa0af82ba Upgrade to jquery-1.12.4; add jquery-migrate plugin (#3548). 2018-02-15 21:38:16 -06:00
evazion 0e259bd4f6 autocomplete: fix issues with Enter key.
* Disable autoFocus. This means that the first item in the autocomplete
  menu isn't automatically selected.

* Add Tab keybinding, to make the Tab key work as normal with autoFocus disabled.

* Fix the Enter key to 1) insert the selected tag when inside the
  autocomplete menu, and 2) submit the search as normal when not inside
  the autocomplete menu.
2018-02-14 22:09:14 -06:00
evazion b877c037b2 autocomplete: factor out insert_completion function. 2018-02-14 20:23:37 -06:00
evazion f0754c21f5 autocomplete: make enter key submit on exact match. 2018-02-13 10:52:43 -06:00
evazion ab86c2049f autocomplete: factor out parse_query function. 2018-02-13 10:36:20 -06:00
evazion e8ab5cdc4c Fix pool version ordering.
Pool version IDs aren't in the right order; order by updated_at instead.
2018-02-08 16:53:02 -06:00
evazion cf27de2ec9 Fix #3532: Make Enter key accept current tag during autocomplete.
Previously we patched the jqueryui-autocomplete library in order to
customize how the Tab and Enter keys behaved. Specifically, we wanted to
prevent the Tab key from moving the focus out of the tag input box, and
we wanted to prevent the Enter key from submitting the page when editing tags.

These things can achieved without patching the library by using
`event.preventDefault` and `event.stopImmediatePropagation` to prevent
other event handlers from running after these keys trigger the
`autocompleteselect` event.
2018-02-06 19:11:01 -06:00
evazion f2a7d3c41a /janitor_trials, /ip_bans: fix default ordering. 2018-02-04 16:48:35 -06:00
evazion dac095f318 /user_feedbacks: change default order to created_at.
Order by created_at instead of by id because old feedbacks aren't in id order.
2018-02-04 16:43:00 -06:00
evazion d4298ea493 Fix #3527: Bookmarklet timeouts for Members. 2018-02-01 17:35:20 -06:00
evazion 5ea61c6921 /bans: fix undefined ordering when no params are passed.
Fixes the /bans listing being ordered randomly by default.
2018-01-28 15:38:12 -06:00
evazion 100c1d2828 Fix #3523: Feedback notification dmails should include the text of the feedback. 2018-01-28 14:32:38 -06:00
evazion 64186c004f Add pbs.twimg.com to artist finder blacklist.
ref: https://danbooru.donmai.us/forum_topics/14938.
2018-01-26 18:30:18 -06:00
evazion f8a5620768 Partial fix for #3514: Handle https://twitter.com/i/web/status/:id URL. 2018-01-23 23:07:21 -06:00
evazion 2833239fa0 Fix #3513: Missing rating error causes weird behavior in tag list on upload page.
Fix bug in the double submit prevention from #2789. Rather than
unbinding the enter key on submit, have the enter key click the submit
button instead. This avoids form submission when the submit button is disabled.
2018-01-21 11:55:24 -06:00
evazion 46b0f9e6d6 Update dotenv.
dotenv-2.2.1 no longer loads .env.local in the test environment. Load it
manually for backwards compatibility.
2018-01-20 19:04:48 -06:00
evazion 074a4be38f Update gems. 2018-01-20 19:04:48 -06:00
evazion a923a64220 tests: fix pixiv profile image test. 2018-01-20 14:51:05 -06:00
evazion 53f7207716 tests: remove bad_id pixiv test. 2018-01-20 14:50:44 -06:00
evazion 57c4d2a54f related tag calculator: fix unstable sorting of related tags.
Fix this test failure:

    1) Failure:
    RelatedTagCalculatorTest#test_: A related tag calculator should convert a hash into string format.
    [test/unit/related_tag_calculator_test.rb:65]:
    Expected: "aaa 3 bbb 3 ccc 2 ddd 1"
      Actual: "bbb 3 aaa 3 ccc 2 ddd 1"

The related tag string didn't use a stable sort. Sort first by tag
count, then by tag name.
2018-01-20 14:33:36 -06:00
evazion e596a7fd0f tests: fix <char>_(cosplay) alias test. 2018-01-20 14:26:16 -06:00
evazion 83ab90d495 tests: fix tag removal warning tests. 2018-01-20 13:59:21 -06:00
evazion 2deefcc090 Fix exception when viewing /favorite_groups while logged out.
Also fixes a test failure in the favgroups controller tests.
2018-01-20 13:47:41 -06:00
evazion e47c983cfd tests: fix pawoo tags test. 2018-01-20 13:25:13 -06:00
evazion c29785268d tests: fix iqdb controller test (#3479). 2018-01-20 13:22:05 -06:00
evazion ce06736374 tests: fix timestamp comparison in artist notes saving test.
Equality test failed due to microsecond level differences. Truncate to
seconds to avoid this.
2018-01-20 13:08:40 -06:00
evazion 3d09ce5e55 tests: fix status:active test for #3472. 2018-01-20 12:50:30 -06:00
evazion 989854b3dd Fix #3507: Include ban length in feedback. 2018-01-17 19:53:49 -06:00
evazion 7a0fb0f5d3 Fix #3500: Redirect API endpoints with md5 query param to correct format. 2018-01-14 20:36:57 -06:00
evazion 88f4a56890 Fix #3497: Invalid DText denial of service attack. 2018-01-14 16:14:18 -06:00
evazion 4f543671a2 tests: move test/helpers to test/test_helpers.
The Rails convention is for test/helpers to be used for testing the view
helpers in app/helpers. We were using it to store certain utility
methods instead. Move these to test/test_helpers so that test/helpers
can be used for its intended purpose.
2018-01-14 16:11:15 -06:00
evazion 7c8cfc1e31 Fix #3492: Add corrupted_image to list of default removed tags for replacements. 2018-01-03 17:44:59 -06:00
evazion f710710cbb PostSets::Post#hide_from_crawler?: hide all metatag searches from crawlers. 2017-12-31 12:27:05 -06:00
evazion f9ffa2b47a Fix #3484: /posts: don't show wiki tab for metatags. 2017-12-31 12:25:17 -06:00
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