Commit Graph
100 Commits
Author SHA1 Message Date
evazion 8125d8e796 Set the default User-Agent sent for outgoing http requests.
* Add a `Danbooru.config.http_headers` config option.

* Refactor various places to use this option instead of setting the user
  agent manually.
2017-07-19 20:25:27 -05:00
evazion 5d013f9c88 /dmails: remove max-width: 50em rule (#3185). 2017-07-19 15:30:14 -05:00
evazion b545a5e7f4 Fix related tags overflow in detachable tag edit dialog (fix #3219).
Bug: resizing the tag edit dialog then expanding the related tags
section doesn't resize the dialog to fit the expanded related tags
section. Instead a scrollbar appears.

Fixes this by expanding the dialog's height when the related tags are
shown.
2017-07-17 19:00:12 -05:00
evazion ffbf5bbcdf Factor out related tags visibility toggling code. 2017-07-17 18:58:20 -05:00
evazion 5d48244df4 Fix related tags overflow in detachable tag edit dialog (#3219).
Fixes these issues with the detachable tag edit dialog:

* Moving the edit dialog then expanding the related tags causes the
related tags to overflow outside the dialog.

* Expanding the related tags, moving the edit dialog, then collapsing
the tags causes the dialog to not resize back to its minimized size.
2017-07-17 18:29:06 -05:00
evazion be4414ae70 /user_upgrades/new: mention debit cards (fix #3221). 2017-07-17 17:01:18 -05:00
evazion 269f69efd8 /user_upgrades/new: convert tabs to spaces. 2017-07-17 16:58:38 -05:00
evazion 19d3df058f /user_upgrades/show: fix typo. 2017-07-17 16:58:34 -05:00
evazion 099ae86cc6 Remove duplicate WikiPageVersion#visible? method.
Already defined by `delegate :visible?, :to => :wiki_page`.
2017-07-14 18:43:52 -05:00
evazion 695804fdda Remove duplicate FavoriteGroup#strip_name method.
This method was defined twice.
2017-07-14 18:39:48 -05:00
evazion cbbf68bdd8 Remove unused tests (#3206). 2017-07-14 18:22:02 -05:00
evazion 4ead45a787 Remove Post#validate_parent_does_not_have_a_parent method (#3206).
Not used; posts are allowed to have grandparents.
2017-07-14 17:49:12 -05:00
evazion 45676491ff Post.fast_count: remove uses of unused statement_timeout param (#3206).
Not used since 81684e6.
2017-07-14 17:35:42 -05:00
evazion 79b21bbca8 Fix failure in Pixiv API call (#3135).
Forgot to send authentication headers with API call.
2017-07-13 15:58:17 -05:00
evazion 5066f75d8c Fix Net::HTTPOK#read_body called twice error during upload (#3135)
Fixes this exception:

    An error occurred: error: IOError - Net::HTTPOK#read_body called twice

    /home/admin/.rbenv/versions/2.3.4/lib/ruby/2.3.0/net/http/response.rb:196:in `read_body'
    /home/admin/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/httparty-0.15.5/lib/httparty/response.rb:91:in `method_missing'
    /home/admin/src/danbooru/app/logical/downloads/file.rb:43:in `block (2 levels) in download!'
    /home/admin/src/danbooru/app/logical/downloads/file.rb:41:in `open'
    /home/admin/src/danbooru/app/logical/downloads/file.rb:41:in `block in download!'
    /home/admin/src/danbooru/app/logical/downloads/file.rb:100:in `http_get_streaming'
    /home/admin/src/danbooru/app/logical/downloads/file.rb:39:in `download!'
    /home/admin/src/danbooru/app/models/upload.rb:408:in `download_from_source'
    /home/admin/src/danbooru/app/models/upload.rb:113:in `block in process_upload'
2017-07-13 15:41:36 -05:00
evazion 9d9ac53e4d /artists/:id - add missing blacklist controls. 2017-07-13 14:15:07 -05:00
evazion 3e3844a796 Remove unused tag subscription code (#2956, #3206). 2017-07-13 13:44:26 -05:00
evazion d3d4e3cc8d Fix #3216: Allow note URL # anchors to work from the post itself 2017-07-12 21:53:26 -05:00
evazion ed7b80c016 /{pools,favgroups}/:id/order/edit: add blacklist controls. 2017-07-11 21:18:00 -05:00
evazion 58923deaa7 saved_searches.js: fix typo. 2017-07-11 19:40:54 -05:00
evazion 6e3763e7d7 Remove minlength for autocompleting labels in saved search dialog.
Trigger autocomplete after typing the first letter when adding labels in
the saved search dialog.
2017-07-11 19:27:04 -05:00
evazion 51d0feb2c6 Fix #3214: Add autocomplete for saved searches.
* Autocomplete the `search:<label>` metatag.

* Make label autocompletion do a prefix match instead of a substring
  match. Example: `search:ar` matches `artists`, not `characters`. This
  is how tags and most other things are autocompleted.
2017-07-11 19:24:49 -05:00
evazion dc079d7932 /saved_searches/labels.json: support wildcards in search[label] param. 2017-07-11 19:21:41 -05:00
evazion 76c90cc0e4 Remove unused Pool methods: create_anonymous/options/id_to_name (#3206)
* Pool.id_to_name: never used.
* Pool.create_anonymous: never used.
* Pool.options: unused since e7aff87.
2017-07-09 14:32:17 -05:00
evazion f3b0a0a9e9 Remove unused KeyValue model (#3206). 2017-07-09 14:30:44 -05:00
evazion af35c82d96 Remove unused Artist#legacy_api_hash method (#3206).
Added in 0e0d83c7 but never used. app/views/legacy/artists.{json,xml}.erb
is what *would* use this, but neither does.
2017-07-09 13:49:20 -05:00
evazion cc8986641b Fix #3208: Fix translated tag suggestions for Pixiv.
* Only suggest the Danbooru tag with the same name if there is no
  matching wiki other name. Example: if we have the Pixiv tag `Fate` and
  the Danbooru tag `fate_(series)` with other name `fate`, suggest that,
  not the Danbooru tag `fate`.

* Don't suggest tags that are empty or whose wiki is deleted.

* Only split tags on "/" if there are no other matches, and only for Pixiv.

* For Pixiv, only include traditional media tags in tag list, not digital media (Photoshop, SAI).

* Add some tests.
2017-07-09 12:10:30 -05:00
evazion e875f2973a /notes, /note_versions: link directly to note within post.
Also adds a "»" link, linking to the note's history.
2017-07-07 16:39:10 -05:00
evazion c13000a41e notes: show note id in note edit dialog title. 2017-07-07 16:09:24 -05:00
evazion ab0b4b4c67 notes: highlight notes linked via /posts/456#note-123. 2017-07-07 16:09:24 -05:00
evazion c2e62b77fa notes: move js initialization into initialize_all function. 2017-07-07 16:09:24 -05:00
evazion 0bc55bec74 notes: redirect /notes/123 to /posts/456#note-123. 2017-07-07 16:09:23 -05:00
evazion df33901938 PostQueryBuilder: remove unused has_constraints attr (#3206).
This was previously used to prevent searches that contained only negated
tags. No longer used.
2017-07-07 16:08:02 -05:00
evazion e3922fb525 flags/appeals controllers: remove unused check_privilege method (#3206). 2017-07-07 15:47:57 -05:00
evazion 24b2f2bf52 /user/dmail_filter: make available to banned users.
`ensure_ownership` handles the privilege check here.
2017-07-07 15:41:09 -05:00
evazion d092b870ad /users/:id/api_keys: make available to banned users.
`check_privilege` already handles the privilege check here.
2017-07-07 15:40:40 -05:00
evazion 0c79d2f09e Removed unused controllers actions / routes (#3206). 2017-07-07 15:38:06 -05:00
evazion d786fc7a55 Removed unused UploadTagsReport controller (#3206).
This was moved to ReportsController#upload_tags as of 7f22baa.
2017-07-07 14:46:04 -05:00
evazion 9e39d292a6 Fix /bulk_update_requests/1234.json. 2017-07-07 14:33:16 -05:00
evazion 400127c090 /saved_searches: make available to banned users. 2017-07-06 19:26:23 -05:00
evazion f5209c7fb9 /favorites: make available to anonymous users. 2017-07-06 19:22:57 -05:00
evazion e6a5d1e9e8 /bulk_update_requests: make available to anonymous users. 2017-07-06 19:20:38 -05:00
evazion 0ed2dafdce /iqdb_queries: make available to anonymous users. 2017-07-06 19:18:45 -05:00
evazion 216243a354 /forum_posts/search: make available to anonymous users. 2017-07-06 19:18:15 -05:00
evazion 3a8cae4de1 /notes/search: make available to anonymous users. 2017-07-06 19:16:43 -05:00
evazion d8f8983f94 /uploads/report_tags: make available to anonymous users. 2017-07-06 19:16:03 -05:00
evazion ecf5040160 /uploads: make available to anonymous users. 2017-07-06 19:14:17 -05:00
evazion bef02e0ac1 /wiki_pages/search: make available to anonymous users. 2017-07-06 19:12:17 -05:00
evazion ef1db967f7 /dmails: allow banned users to read/delete dmails. 2017-07-06 18:39:42 -05:00
evazion cda1ee3d88 /users: allow banned users to edit account settings.
The member_only check prevents banned users from editing their account
settings. This isn't needed since check_privilege handles the privilege check.
2017-07-06 18:39:42 -05:00
evazion cc54c16fac /artists/show_or_new: make public; add "artist doesn't exist" page.
* Fix access denied error when anonymous users open /artists/show_or_new.

* When the artist doesn't exist, take user to "artist doesn't exist"
  page instead of redirecting to /artists/new.
2017-07-06 18:37:13 -05:00
evazion e5598be20e Factor out artists/show view into artists/_show layout. 2017-07-06 18:15:12 -05:00
evazion 68bf355542 upload tags report: add blacklist controls (#3121). 2017-07-05 19:40:48 -05:00
evazion aac1463fbf implications: count 'queued' implications as active.
Bug: implications that were approved but that were still in the 'queued'
state were not seen as active yet, which led to the transitivity
validation passing because it didn't include queued implications.
2017-07-05 00:22:27 -05:00
evazion 542c673221 Fix #3200: Disallow creation of superfluous implications.
Disallow transitive implications. If a -> b -> c already exists, don't
allow a -> c.

Caveat: if b -> c already exists, and we make a BUR for a -> b and a -> c,
the BUR validates even though a -> c is redundant. It only fails
when the BUR is approved.
2017-07-05 00:22:16 -05:00
evazion cda35494a4 Disable blacklists on pages without blacklist controls. (#3183) 2017-07-03 15:10:36 -05:00
evazion c3ac4f3329 Fix #3197 - Post Replacement comment: use Replacement URL instead of Final Source
Record the URL of the image that was actually downloaded as the replacement URL.
2017-07-02 21:00:26 -05:00
evazion 5a2745ee71 Fix post replacement controller test.
Broken in 27aa9fe. Delayed jobs have to be enabled when creating a
replacement, otherwise replacement will try to immediately delete the
existing files, which fails because they're still in use.
2017-07-01 13:37:32 -05:00
evazion 0390039621 Fix expunging posts from S3 (fixup 4c4ef5c / #3180). 2017-07-01 12:30:59 -05:00
evazion f8ed7d4357 tests: fix HTTP requests failing due to webmock (#3039).
Fixes failures in source tests caused by Webmock disabling non-stubbed
HTTP requests by default.

https://github.com/bblimke/webmock#real-requests-to-network-can-be-allowed-or-disabled
2017-07-01 12:22:36 -05:00
evazion 1c06ae9f81 atom feeds: fix deprecation warnings in *_path helpers.
DEPRECATION WARNING: You are calling a `*_path` helper with the
`only_path` option explicitly set to `false`. This option will stop
working on path helpers in Rails 5. Use the corresponding `*_url` helper
instead.
2017-07-01 11:45:28 -05:00
evazion 71f84b10af tumblr: convert commentary to dtext.
* Convert Tumblr commentary to DText.
* Strip extraneous whitespace in links and blockquotes.
* Add newlines after block elements to ensure they're separated from
  subsequent blocks.
2017-07-01 11:15:48 -05:00
evazion b880b07387 sources: factor out html-to-dtext code to DText.from_html. 2017-07-01 11:15:48 -05:00
evazion e3a4bfd28c /upload/batch: use image proxy for embedded thumbnails. 2017-06-27 13:46:59 -05:00
evazion 281ddae35d /uploads/batch: add thumbnail previews (#3194). 2017-06-27 13:31:47 -05:00
evazion 9c50b24306 post replacements: add "Tags" field to dialog box.
* Adds a "Tags" field to the post replacement dialog box. The given tags
  are added to the post after replacement.

* Prefills the Tags field with certain tags that usually need to be
  removed after replacement: replaceme, image_sample, jpeg_artifacts, etc.
2017-06-26 18:17:16 -05:00
evazion 8d22ab9de8 post replacements: record upload source/filename in replacement_url.
* Record "file://#{filename}" as the replacement url when the
  replacement comes from an uploaded file.

* Record the actual url downloaded by the upload process otherwise. This
  may be different from the url given by the user, since the upload
  process may rewrite the url.
2017-06-26 14:18:57 -05:00
evazion 4fd1c6ec21 /post_replacements: fix broken source links (missing href). 2017-06-26 10:26:58 -05:00
evazion 465be6bdf5 /post_replacements: fix thumbnails of deleted posts not showing. 2017-06-26 10:25:57 -05:00
evazion fbb25666b0 tumblr: add source tests. 2017-06-25 15:34:15 -05:00
evazion 030052bf14 tumblr: rewrite html pages to image url. 2017-06-25 15:34:15 -05:00
evazion 118843b26a tumblr: fetch tags, commentary, and image urls. 2017-06-25 15:34:15 -05:00
evazion d5ce6c98ef tumblr: add tumblr api client. 2017-06-25 15:34:15 -05:00
evazion c25ca4c45c {approvals,disapprovals}/create.js.erb: fix indentation. 2017-06-25 11:09:07 -05:00
evazion 791cbbf23b Fix #3186: Mod queue: hide item even if approve/reject fails. 2017-06-25 11:08:05 -05:00
evazion 5605f0fe0b Fix #3185: Dmail Show View incorrectly using class instead of ID. 2017-06-25 10:39:49 -05:00
evazion 4681812607 /artist_commentary_versions: format commentary as dtext. 2017-06-25 10:28:46 -05:00
evazion 1889864049 /artist_commentary_versions: show post thumbnails.
Show thumbnails in the /artist_commentary_versions listing. Don't show
thumbnails when viewing the version history of a single post.
2017-06-25 10:27:43 -05:00
evazion 6329d089ee post replacements: add tag match field to search form. 2017-06-22 17:03:05 -05:00
evazion 8b4e598a12 post replacements: add /post_replacements view. 2017-06-22 17:03:05 -05:00
evazion 13d49467a2 post replacements: fix search[creator_name]=... param. 2017-06-22 16:53:20 -05:00
evazion 41b9a8a044 post replacements: fix post_replacements_path helper.
Bug: `post_replacements_path` returned the wrong path because the
`/posts/:post_id/replacements` route took precedence over the
`/post_replacements` route.

Fix: declare the `/post_replacements` route first so that it takes
precedence instead.
2017-06-22 16:53:20 -05:00
evazion d3e8937716 post replacements: allow replacing with an uploaded file. 2017-06-22 16:52:55 -05:00
evazion c27668d2ef post replacements: add option to fix source after replacement.
Adds a "Final Source" field to the post replacement dialog. If
specified, the post's source field will be changed to this value after
replacement.

This makes fixing the source back to the HTML page after
replacement easier.
2017-06-22 16:51:55 -05:00
evazion 55512130e1 css: set text fields in dialogs to 100% width.
* Fixes the flag reason field being too small in the flag dialog
* Fixes the source field being too small in the post replacement dialog.
2017-06-22 14:19:28 -05:00
evazion 421bbc35a2 tumblr: rewrite samples to biggest available version. 2017-06-21 22:30:53 -05:00
evazion a9b3d28215 tumblr: fix edgecastcdn.net rewrite + add test.
https://data.tumblr.com doesn't have a valid SSL cert, so we must use
http:// instead when we rewrite to it.
2017-06-21 21:10:07 -05:00
evazion 16a51533bc tests: refactor tumblr tests to use assert_downloaded. 2017-06-21 21:10:07 -05:00
evazion 5684ba3b1d tests: factor out assert_downloaded to DownloadTestHelper. 2017-06-21 21:10:07 -05:00
evazion dc36476d50 nijie: don't return bogus artists when artist finder finds no match. 2017-06-20 17:09:57 -05:00
evazion 294358b4a6 nijie: fetch image_urls for batch bookmarklet. 2017-06-20 16:29:31 -05:00
evazion 2d5fc191dd nijie: convert commentary to dtext. 2017-06-20 16:11:16 -05:00
evazion 25e7db860a nijie: fetch artist commentary. 2017-06-20 16:11:16 -05:00
evazion 3560bbbd47 pawoo: don't return bogus artists when artist finder doesn't find a match. 2017-06-19 17:10:02 -05:00
evazion 655e53fe65 pawoo: rewrite /small/ images to /original/ 2017-06-19 17:10:02 -05:00
evazion 14196f36d8 pawoo: convert commentary to dtext. 2017-06-19 17:10:02 -05:00
evazion 6edb5a807b pawoo: fetch tags and commentary. 2017-06-19 17:10:02 -05:00
evazion 1bfc0a7d8a pawoo: get status id from normalized url. 2017-06-19 17:09:57 -05:00
evazion e91942dff3 pawoo: add source tests and docs. 2017-06-19 17:09:57 -05:00
evazion a60520ef6a pawoo: add credentials to default config. 2017-06-19 17:08:52 -05:00