Bug: if a user replaces a post with another image, then replaces the
post back to the original image, then the deletion job for the original
image will still run. The will delete the original file, but that file
is now in use again and should not be deleted.
Adding a post id to a pool's post_ids string is non-atomic, hence we
must lock the pool to avoid a race condition.
Adding a pool to a post's pool_string is likewise non-atomic, hence we
must lock the post as well.
calculate_from_sample is called when clicking the General / Artist /
Copyright / Characters buttons during tag editing. Currently it's slow
because it counts up the tags in ruby, and because it makes repeated
calls to memcache in the inner loop when filtering tags by category.
This changes it to do the counting and filtering entirely in SQL using a
GROUP BY tag / COUNT(*) aggregation. This is faster and makes larger
sample sizes more feasible.
Previously we used 'http://$artist.deviantart.com/gallery/#/d$id'. This
relied on a javascript redirect on Deviantart's end, which didn't work
for people with javascript disabled.
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'
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=`.
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.