Commit Graph

5510 Commits

Author SHA1 Message Date
r888888888
d3e876bedf fixes img-master urls for pixiv source #2946 2017-04-04 12:53:52 -07:00
r888888888
3190ecb601 dont autoremove animated_gif and animated_png tags on update #2500 2017-04-04 12:44:45 -07:00
r888888888
a5e55eda3d prune supervoters in daily maint 2017-04-04 12:39:17 -07:00
r888888888
0b8d4105aa fix tests 2017-04-04 12:39:17 -07:00
Albert Yi
347ffb5989 Merge pull request #2959 from evazion/fix-move-hidden-favs
Move hidden favorites when moving favs.
2017-04-04 12:38:56 -07:00
evazion
777937591e Post#give_favorites_to_parent: move hidden favs. 2017-04-03 22:36:20 -05:00
Albert Yi
690d022cb4 Merge pull request #2957 from evazion/fix-pximg-gallery-samples
Fix i.pximg.net manga gallery samples (fix #2946)
2017-04-03 15:22:31 -07:00
Albert Yi
3509850e19 Merge pull request #2958 from evazion/fix-2955
Fix #2955: Reapproval error for unapproved post
2017-04-03 15:21:21 -07:00
evazion
5db39f308a tests: fix post approval tests. 2017-04-03 17:18:32 -05:00
evazion
7c8135609b post_approval_test.rb: tabs to spaces. 2017-04-03 17:18:32 -05:00
evazion
e6328b8d30 post_approval_test.rb: move to test/unit. 2017-04-03 17:18:32 -05:00
evazion
70a7f77a48 Post#approve!: signal errors with invalid object instead of exception. 2017-04-03 17:18:32 -05:00
evazion
db0bcf08b9 Post#approve!: move approving logic to post_approval.rb. 2017-04-03 17:18:31 -05:00
evazion
258fc37bfe Post#approve!: move validation to post_approval.rb 2017-04-03 17:18:31 -05:00
evazion
4b138be6b9 Rewrite i.pximg.net manga gallery samples. 2017-04-03 17:17:22 -05:00
evazion
af4708dde9 Fix typo in i.pximg.net download strategy. 2017-04-03 17:17:22 -05:00
r888888888
70f02af8d7 fixes #2953: Tag change report doesn't take tags removed by user into account 2017-04-03 15:11:21 -07:00
r888888888
87ff449f20 fixes #2951: /post_versions is extremely slow 2017-04-03 15:03:59 -07:00
evazion
3c89ee3199 tests: add more post/pool version creation tests.
Adds the `test_after_commit` gem too because after_commit callbacks
don't fire inside tests in rails <5.0.
2017-04-03 15:03:59 -07:00
evazion
8fff3315f2 fix #2950: don't send versions to archives if save fails. 2017-04-03 15:03:58 -07:00
Type-kun
1578c56b9d Additional fix for #2946 2017-04-03 15:03:26 -07:00
evazion
1ae5b7ba2f post archives: fix N+1 problem when fetching previous version. 2017-04-03 15:03:26 -07:00
evazion
964197d403 upload tags report: fix N+1 queries issues. 2017-04-03 15:03:26 -07:00
evazion
765fbac11d /reports/upload_tags: show thumbnails instead of post ids. 2017-04-03 15:03:26 -07:00
evazion
fdd8ebb1b8 /users/1234: link to upload tag changes report. 2017-04-03 15:03:26 -07:00
r888888888
8d58e27d0b additional support for pximg.net hosts 2017-04-03 15:03:26 -07:00
evazion
25b2b399cc saved searches: fix exception when searching for search:adfijoioi.
Fixes this exception:

    NoMethodError exception raised

    undefined method `empty?' for nil:NilClass
    app/logical/post_query_builder.rb:113:in `block in add_saved_search_relation'
    app/logical/post_query_builder.rb:106:in `each'
    app/logical/post_query_builder.rb:106:in `add_saved_search_relation'
    app/logical/post_query_builder.rb:237:in `build'
    app/models/post.rb:1624:in `tag_match'
    app/models/post.rb:1172:in `block in fast_count_search'
    config/initializers/active_record_extensions.rb:16:in `with_timeout'
    app/models/post.rb:1171:in `fast_count_search'
    app/models/post.rb:1162:in `fast_count'
    app/logical/post_sets/post.rb:106:in `get_post_count'
    app/logical/post_sets/post.rb:122:in `posts'
    app/controllers/posts_controller.rb:15:in `index'

caused by this failure in listbooru when you send it an empty array as the list of queries:

    Redis::CommandError - ERR wrong number of arguments for 'zunionstore' command:

    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/redis-3.3.3/lib/redis/client.rb:121:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/redis-3.3.3/lib/redis.rb:1932:in `block in zunionstore'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/redis-3.3.3/lib/redis.rb:58:in `block in synchronize'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/redis-3.3.3/lib/redis.rb:58:in `synchronize'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/redis-3.3.3/lib/redis.rb:1931:in `zunionstore'
    web/listbooru.rb:85:in `aggregate_searches'
    web/listbooru.rb:104:in `block in <main>'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `block incompile!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:994:in `route_eval'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1015:in `block inprocess_route'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `catch'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `process_route'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:973:in `block in route!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `each'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `route!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1085:in `block indispatch!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block ininvoke'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1082:in `dispatch!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `block in call!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block ininvoke'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `call!'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:895:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-1.6.5/lib/rack/logger.rb:15:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-1.6.5/lib/rack/commonlogger.rb:33:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:219:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:212:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-1.6.5/lib/rack/head.rb:13:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/show_exceptions.rb:25:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:182:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:2013:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `block incall'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1787:in `synchronize'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `call'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-1.6.5/lib/rack/handler/webrick.rb:88:in `service'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
    /home/admin/.rbenv/versions/2.4.1/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
2017-04-03 15:03:26 -07:00
r888888888
efe12b95d6 fixes #2945: Wiki Page Autocomplete Should Hide Deleted Wikis 2017-03-29 12:28:32 -07:00
r888888888
6d2d381af6 revert migration change 2017-03-27 16:53:12 -07:00
r888888888
16ba4fac6a remove pre-existing index 2017-03-27 16:50:38 -07:00
r888888888
dd4a70c195 fixes #2935: Eliminate the og:description meta tag 2017-03-27 16:01:22 -07:00
r888888888
7e40f9363d fixes #2939: <code> Blocks Need CSS Styling 2017-03-27 16:00:43 -07:00
r888888888
c74b1d532a adjust interval for mod queue notice 2017-03-27 15:53:59 -07:00
r888888888
54f0474d49 fixes #2930: Support new Pixiv image hostname (i.pximg.net) 2017-03-27 15:53:32 -07:00
Albert Yi
8cd07ae70b Merge pull request #2937 from evazion/fix-move-fav-upvotes
Upvote correctly when moving favorites (partial fix for #2936)
2017-03-27 15:24:13 -07:00
Albert Yi
42740c1d88 Merge pull request #2941 from evazion/fix-2940
Fix exception in `h(post.source)` when source is nil (fixes #2940).
2017-03-27 15:12:31 -07:00
Albert Yi
b1868aa37e Merge pull request #2943 from evazion/fix-animated-gif
Fix exception when autotagging animated_gifs
2017-03-27 14:49:43 -07:00
evazion
5f1b7f48f7 Fix exception when autotagging animated_gifs.
Fixes this exception caused by the animated_gif autotagger trying to access the
image file, which fails if the image is not hosted on the webserver.

Magick::ImageMagickError exception raised

    unable to open image `/var/www/danbooru2/releases/20170322212609/public/data/f0e32c0e2d906c4932858866346f98b5.gif': No such file or directory @ error/blob.c/OpenBlob/2712
    app/models/post.rb:177:in `ping'
    app/models/post.rb:177:in `is_animated_gif?'
    app/models/post.rb:684:in `add_automatic_tags'
    app/models/post.rb:638:in `normalize_tags'
    app/controllers/posts_controller.rb:49:in `update'
2017-03-26 18:12:13 -05:00
evazion
26e8b7144a Fix exception in h(post.source) when source is nil (fixes #2940).
Fixes this exception:

    TypeError exception raised

    no implicit conversion of nil into String
    app/presenters/presenter.rb:3:in `escapeHTML'
    app/presenters/presenter.rb:3:in `h'
    app/presenters/post_presenter.rb:91:in `data_attributes'
    app/presenters/post_presenter.rb:24:in `preview'
    app/presenters/post_set_presenters/base.rb:15:in `block in post_previews_html'
    app/presenters/post_set_presenters/base.rb:14:in `post_previews_html'
    app/views/posts/partials/index/_posts.html.erb:3:in `_app_views_posts_partials_index__posts_html_erb___2716396856929289512_70158315986180'
    app/views/posts/index.html.erb:39:in `_app_views_posts_index_html_erb__1345252938355811220_70158296799280'
    app/controllers/posts_controller.rb:16:in `index'
2017-03-25 23:43:20 -05:00
evazion
163d338874 post_vote_test.rb: add more voting tests. 2017-03-24 15:43:55 -05:00
evazion
4470828a3d post_test.rb: add tests for moving favorites. 2017-03-24 15:43:55 -05:00
evazion
a5ecda2f0e post_test.rb: fix voting tests. 2017-03-24 15:43:55 -05:00
evazion
3dc854c0c8 post_vote.rb: determine vote magnitude from voter, not CurrentUser.
Bug: when moving favorites, the parent is given an upvote for each gold+
favoriter, but the magnitude of these upvotes was based on the
CurrentUser, rather than the upvoter. This meant that upvotes for
supervoter favorites weren't given correctly.

To fix this, `magnitude` is changed to use the voting `user` instead of
CurrentUser.

New problem: when setting the score, `score=` calls `magnitude`, but
`user` isn't initialized yet. So we also refactor so that

    1. `initialize_attributes` initializes `user` before setting `score`
    2. the vote direction is given by `vote`, so it's separate from `score`
    3. updating the score on the post happens in a callback instead of
       directly in `score=`.
2017-03-24 15:43:55 -05:00
evazion
07707b257a post.rb: make non-gold supervoters upvote when fav'ing a post. 2017-03-24 15:43:55 -05:00
evazion
fd24ea5876 posts.rb: vote on behalf of correct user when moving favorites.
Bug: when an approver moves the favorites of a post, each favorite is
removed from the child post and added to the parent post. For gold+
users, this triggers an upvote, but these upvotes were performed by the
approver rather than the favoriter.
2017-03-24 15:43:28 -05:00
evazion
73b19bee05 Fix exception in h(post.source) when source is nil.
Fixes this exception:

    TypeError exception raised

    no implicit conversion of nil into String
    app/presenters/presenter.rb:3:in `escapeHTML'
    app/presenters/presenter.rb:3:in `h'
    app/presenters/post_presenter.rb:91:in `data_attributes'
    app/presenters/post_presenter.rb:24:in `preview'
    app/presenters/post_set_presenters/base.rb:15:in `block in post_previews_html'
    app/presenters/post_set_presenters/base.rb:14:in `post_previews_html'
    app/views/posts/partials/index/_posts.html.erb:3:in `_app_views_posts_partials_index__posts_html_erb___2716396856929289512_70158315986180'
    app/views/posts/index.html.erb:39:in `_app_views_posts_index_html_erb__1345252938355811220_70158296799280'
    app/controllers/posts_controller.rb:16:in `index'
2017-03-24 00:26:54 -05:00
Albert Yi
db09acf8a4 Merge pull request #2932 from evazion/fix-reltags-sqs
sqs_service.rb: fix exception when related tags sqs not configured.
2017-03-23 10:46:45 -07:00
Albert Yi
7f7f843763 Merge pull request #2933 from evazion/feat-doc-cosplay-autotags
Fix #2931: mention automated implications on *_(cosplay) wikis.
2017-03-23 10:46:20 -07:00
Albert Yi
f30f21f891 Merge pull request #2934 from evazion/opt-mod-dashboard
/moderator/dashboard: optimize sql queries
2017-03-23 10:45:37 -07:00
evazion
66b5dc641c /moderator/dashboard: use PostPresenter.preview for appeal thumbnails. 2017-03-23 04:05:06 -05:00