Commit Graph

1321 Commits

Author SHA1 Message Date
Albert Yi
6839249e9d add logic for persisting pixiv sessions in tests 2018-05-10 13:59:57 -07:00
Albert Yi
5bfadb90c3 add retry for failed pixivapiclient auth calls 2018-05-10 11:22:23 -07:00
Albert Yi
fe3fc51681 fix bug with postkeepermanager not loading a post from an id 2018-05-10 09:56:18 -07:00
Albert Yi
3c894eaf86 increase timeout for pixiv api connections 2018-05-10 09:49:46 -07:00
Albert Yi
0d7aa921d6 add hourly check for delayed job errors 2018-05-09 17:33:02 -07:00
Albert Yi
bc4010fe6c when PostKeeperManager.check_and_update fails, retry (fixes #3699) 2018-05-09 17:09:20 -07:00
Albert Yi
99012ff342 fix tests 2018-05-09 11:59:51 -07:00
Albert Yi
79ea6f7e6c Add Docker and Travis config files to enable CI tests
Also fixes some Rails 6.0 deprecation warnings
2018-05-09 09:56:38 -07:00
Albert Yi
23bef55632 Merge pull request #3700 from evazion/fix-3659
Fix uploads getting stuck in 'processing' state (fix #3659)
2018-05-07 17:36:03 -07:00
Albert Yi
3d3bae1228 Merge pull request #3697 from evazion/fix-3696
Fix #3696: API: handle boolean params consistently
2018-05-07 17:35:29 -07:00
evazion
181a906766 Fix #3695: Bookmarklet breaks on pixiv fanbox direct image links. 2018-05-05 12:21:11 -05:00
evazion
c584ca5b19 Fix uploads getting stuck in 'processing' state (fix #3659).
Bug: if an upload timed out while downloading the file, Upload#process!
would catch the error and attempt to retry, but since the upload was
already in the 'processing' state, on the second try `process!` would
bail out immediately and leave the upload stuck in the 'processing' state.

Fix: remove the retry logic from Upload#process!. Let Downloads::File#download!
(which had its own retry logic) handle it instead.
2018-05-05 11:42:40 -05:00
evazion
c7492343ce String: add truthy? & falsy? core extensions.
* Add `truthy?` and `falsy?` core extensions to String.

* Use `truthy?` and `falsy?` to replace ad-hoc parsing of boolean
  parameters in various places.
2018-05-03 19:57:14 -05:00
evazion
a6499b5169 post tooltips: add disable option (#3689).
* Add "disable post tooltips" account setting.
* Add back title attribute for when fancy tooltips are disabled.
2018-04-28 23:50:51 -05:00
evazion
603a27f495 related tags: fix deprecation warning in order("count(*) DESC").
DEPRECATION WARNING: Dangerous query method (method whose arguments are
used as raw SQL) called with non-attribute argument(s): "count(*) DESC".
Non-attribute arguments will be disallowed in Rails 6.0. This method
should not be called with user-provided values, such as request
parameters or model attributes. Known-safe values can be passed by
wrapping them in Arel.sql(). (called from block in calculate_from_sample
at /home/admin/src/danbooru/app/logical/related_tag_calculator.rb:66)
2018-04-28 22:00:20 -05:00
evazion
3ef23faae2 Fix #3669: Normalize mobile.twitter.com sources.
* Normalize sources to https://twitter.com/#{artist_name}/status/#{status_id} after upload.
* Make fetch source data use screen name instead of display name for the artist name.
2018-04-27 00:36:13 -05:00
evazion
c9f35cbacc tag alias corrections: fix ActionView::Template::Error exception (#3668). 2018-04-27 00:17:14 -05:00
Albert Yi
f2b525a6d2 Implement forum topic voting and tag change pruning (#3580) 2018-04-26 15:31:06 -07:00
Albert Yi
4b6019d6ad fixes #3668 2018-04-26 10:25:24 -07:00
evazion
d70a0a64bd Remove controller-level force_ssl checks.
Obsoleted by force_ssl being globally enabled by default.
2018-04-19 00:49:50 -05:00
evazion
7d295a11d0 fixup! Fix #3654: Deviantart commentaries fail fetching. 2018-04-18 19:01:33 -05:00
evazion
c4ae2bd2fa Fix #3654: Deviantart commentaries fail fetching. 2018-04-18 18:44:56 -05:00
evazion
d42ef7d7dc Fix #3642: Issues with sequential pagination.
As of Rails 5, overriding `to_a` on an ActiveRecord collection does
nothing. We need to override `records` instead.

ref: cdd45fa09d
2018-04-14 10:56:20 -05:00
evazion
074b66bf27 pagination: prefer extending over `extend.
The `extending` method is the preferred way to add methods to an ActiveRecord collection.

* http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-extending
* https://ruby-doc.org/core-2.5.0/Object.html#method-i-extend
2018-04-14 10:56:16 -05:00
evazion
302994e5d9 Fix #3639: Favorite count pixiv tags aren't skipped by translated tags. 2018-04-13 22:39:52 -05:00
evazion
28cd633210 Fix #3637: Bookmarklet fails on artstation for some posts. 2018-04-13 11:18:09 -05:00
Albert Yi
37ba6714d1 fixes #3617 2018-04-12 12:11:27 -07:00
Albert Yi
03e2a2ca3b add rake task for distributing images using storage managers 2018-04-12 10:40:24 -07:00
evazion
4233d2149f Fix delete_all / destroy_all calls. 2018-04-11 22:33:11 -05:00
Albert Yi
d9d98f05c2 Merge branch 'rails-5.1' 2018-04-11 11:40:36 -07:00
evazion
ab25e73cd7 deviantart: replace html scraper with api client (#3260). 2018-04-09 20:53:14 -05:00
evazion
2d6b7177de deviantart: add api client. 2018-04-09 20:53:06 -05:00
Albert Yi
23fef71346 Merge pull request #3609 from evazion/fix-3603
Fix #3603: Unable to view images on Hijiribe/Sonohara when Danbooru is blocked
2018-04-09 10:56:00 -07:00
Albert Yi
5f33238074 Merge pull request #3612 from evazion/fix-iqdb-errors
Improve IQDB error handling
2018-04-09 10:53:40 -07:00
evazion
2cbec785ea Fix #3613: Broken preview images for flash files. 2018-04-08 11:49:30 -05:00
evazion
4097305e52 StorageManager::Hybrid#open_file: fix typo. 2018-04-07 21:06:38 -05:00
evazion
8de20d2b36 Iqdb::Download.find_similar: raise on iqdb errors.
* Raise an error on iqdb errors instead of returning no matches.
* Include the iqdb api response in the error response.
2018-04-07 18:03:10 -05:00
evazion
b88a66dd30 Iqdb::Download.find_similar: simplify error handling.
Raise errors immediately to avoid deeply nested if-else statements.
2018-04-07 18:03:10 -05:00
evazion
d8142a6c21 iqdb_queries_controller.rb: simplify show / check actions.
* Combine create_by_post + create_by_url. Rename to find_similar.
* Move iqdb enabled check to find_similar.
2018-04-07 18:03:01 -05:00
evazion
1b14545d0d Fix #3603: Unable to view images on Hijiribe/Sonohara when Danbooru domain is blocked. 2018-04-06 21:25:14 -05:00
r888888888
abce4d2551 Raise error on unpermitted params.
Fail loudly if we forget to whitelist a param instead of silently
ignoring it.

misc models: convert to strong params.

artist commentaries: convert to strong params.

* Disallow changing or setting post_id to a nonexistent post.

artists: convert to strong params.

* Disallow setting `is_banned` in create/update actions. Changing it
  this way instead of with the ban/unban actions would leave the artist in
  a partially banned state.

bans: convert to strong params.

* Disallow changing the user_id after the ban has been created.

comments: convert to strong params.

favorite groups: convert to strong params.

news updates: convert to strong params.

post appeals: convert to strong params.

post flags: convert to strong params.

* Disallow users from setting the `is_deleted` / `is_resolved` flags.

ip bans: convert to strong params.

user feedbacks: convert to strong params.

* Disallow users from setting `disable_dmail_notification` when creating feedbacks.
* Disallow changing the user_id after the feedback has been created.

notes: convert to strong params.

wiki pages: convert to strong params.

* Also fix non-Builders being able to delete wiki pages.

saved searches: convert to strong params.

pools: convert to strong params.

* Disallow setting `post_count` or `is_deleted` in create/update actions.

janitor trials: convert to strong params.

post disapprovals: convert to strong params.

* Factor out quick-mod bar to shared partial.
* Fix quick-mod bar to use `Post#is_approvable?` to determine visibility
  of Approve button.

dmail filters: convert to strong params.

password resets: convert to strong params.

user name change requests: convert to strong params.

posts: convert to strong params.

users: convert to strong params.

* Disallow setting password_hash, last_logged_in_at, last_forum_read_at,
  has_mail, and dmail_filter_attributes[user_id].

* Remove initialize_default_image_size (dead code).

uploads: convert to strong params.

* Remove `initialize_status` because status already defaults to pending
  in the database.

tag aliases/implications: convert to strong params.

tags: convert to strong params.

forum posts: convert to strong params.

* Disallow changing the topic_id after creating the post.
* Disallow setting is_deleted (destroy/undelete actions should be used instead).
* Remove is_sticky / is_locked (nonexistent attributes).

forum topics: convert to strong params.

* merges https://github.com/evazion/danbooru/tree/wip-rails-5.1
* lock pg gem to 0.21 (1.0.0 is incompatible with rails 5.1.4)
* switch to factorybot and change all references

Co-authored-by: r888888888 <r888888888@gmail.com>
Co-authored-by: evazion <noizave@gmail.com>

add diffs
2018-04-06 18:09:57 -07:00
Albert Yi
fc344e589d potential fix for #3604 2018-04-06 16:14:01 -07:00
evazion
a432980f85 Fix "wrong number of arguments (given 3, expected 2)" in Post#file_url. 2018-04-05 15:33:47 -05:00
Albert Yi
7d745ac93f Merge pull request #3598 from evazion/fix-3597
Possible fix for #3597: Poor performance since last deploy
2018-04-05 13:11:21 -07:00
Albert Yi
bf23a976e3 fix bug with async tagger check 2018-04-05 12:51:29 -07:00
evazion
084fcd91ed Only generate tagged filenames for URLs on post show pages (#3597).
Don't generate tagged filenames for urls in the data attributes on
thumbnails, or in the /posts.json api.
2018-04-05 14:20:37 -05:00
Albert Yi
b219992b7d add async processing for top tagger 2018-04-03 16:00:36 -07:00
evazion
04ecca6a06 Fix #3591: DeviantArt commentaries: strip embedded image/text thumbs. 2018-03-31 11:27:14 -05:00
evazion
80219a0ccf commentaries: replace <img> tags with dtext links (#3586)
Replace <img> tags with dtext links, unless the <img> tag is already
inside an <a> tag.

Also strip Unicode spaces from DeviantArt commentaries.
2018-03-30 21:42:51 -05:00
evazion
b185efbb5f tumblr commentaries: include asker's name in ask posts (#3586). 2018-03-30 21:42:51 -05:00