Commit Graph

509 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
evazion
777937591e Post#give_favorites_to_parent: move hidden favs. 2017-04-03 22:36:20 -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
r888888888
87ff449f20 fixes #2951: /post_versions is extremely slow 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
964197d403 upload tags report: fix N+1 queries issues. 2017-04-03 15:03:26 -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
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
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
4fde2a26fb post.rb: handle automatic *_(cosplay) tags in TagImplication. 2017-03-23 02:48:03 -05:00
r888888888
b3e3012a9c link to upload advice thread for deleted posts 2017-03-22 16:33:14 -07:00
r888888888
e946d23fa7 enable s3 proxy (wave 1) 2017-03-09 18:18:06 -08:00
evazion
2bb134f08d modqueue: highlight uploads containing "bad" tags. 2017-03-01 15:31:16 -06:00
Albert Yi
5404c1d231 implement postarchive 2017-02-21 13:40:52 -08:00
evazion
c926f75918 fixup! post.rb: validate newly added tags. 2017-02-09 02:14:48 -06:00
evazion
facf819620 post.rb: validate newly added tags.
Existing tags with invalid names are still permitted. This is to allow
for a gradual transition to good tag names.
2017-02-08 23:31:30 -06:00
evazion
347f11b935 post.rb: group validation methods together. 2017-02-08 23:31:30 -06:00
r888888888
f0a8598ba2 update aws gem, stub in rake tasks for s3 2017-02-08 15:06:54 -08:00
r888888888
b57b54113f add cdn hosted flag to posts 2017-02-07 17:26:16 -08:00
Albert Yi
1c837aba6e Merge pull request #2879 from evazion/fix-dead-code
Eliminate dead code
2017-02-07 13:56:05 -08:00
evazion
b5bf9b8678 post.rb: remove assorted unused methods. 2017-02-06 19:07:03 -06:00
evazion
35b3398142 post_test.rb: add more metatag search tests. 2017-02-06 18:48:39 -06:00
Albert Yi
4357c6e718 Merge pull request #2874 from evazion/fix-tests
Fix various failing tests
2017-02-03 14:28:42 -08:00
r888888888
497011289f fixes #2865: Undeleting a post doesn't resolve flags 2017-02-03 14:22:21 -08:00
evazion
a327854017 Fix post_update_count increment test.
7) Failure:
PostTest#test_: Tagging: A post that has been updated should increment the updater's post_update_count. [/home/danbooru/src/danbooru/test/unit/post_test.rb:1010]:
"CurrentUser.post_update_count" didn't change by 1.
Expected: 1
  Actual: 3
2017-02-03 04:04:02 -06:00
evazion
50b793d129 Don't send failed uploads to IQDB (possible fix for #2867). 2017-02-02 01:26:59 -06:00
r888888888
bfa56a860c fixes #2415: "Random post" causes RecordNotFound exceptions 2017-01-18 14:12:12 -08:00
r888888888
237c997ae1 remove usage of increment! #2835 2017-01-17 15:46:21 -08:00
Albert Yi
61c40e042b Merge pull request #2823 from evazion/fix-fav-order
Fix ordering of favlist
2017-01-09 17:36:46 -08:00
Albert Yi
5445b341bc fixes #2822: Post vote API: returns 200 for both success and failure; fixes bug with x-api-limit header 2017-01-09 17:31:14 -08:00
Type-kun
160d2a47aa Fixes #2758 2017-01-09 15:53:58 +05:00
evazion
2763f7e137 Fix ordering of favlists (sort by users who favorited first).
Fix bug introduced in 6e62a4c.
2017-01-08 00:57:36 +00:00
evazion
b9fa5a0816 posts: don't revalidate md5 uniqueness on every update. 2017-01-05 14:31:02 -06:00
Albert Yi
094f30a44e Merge pull request #2819 from evazion/opt-favorited-users
Reduce SQL queries on /posts/:id
2017-01-03 16:29:20 -08:00
Albert Yi
4d698bf98b add modaction helper 2017-01-03 15:04:47 -08:00
evazion
4e8006ae3b Optimize rendering of post commenter names.
Eager load post comments' creators and updaters. Fixes an N+1 queries
problem when rendering commenter names at:

    views/comments/partials/show/_comment.html.erb:6
    views/comments/partials/show/_comment.html.erb:20

while rendering /posts/:id pages.
2017-01-03 20:14:05 +00:00
evazion
6e62a4cc33 Optimize Post#favorited_users.
Load users in one query rather than one query per user.
2017-01-03 18:21:05 +00:00
Albert Yi
0ea7d78584 remove usage of vcr cassettes; delete unused fixtures; fix some broken unit tests 2016-12-28 15:47:28 -08:00
r888888888
2584646017 add additional formatting for delayed job listing 2016-12-24 18:00:40 -08:00
evazion
5302b804f1 Fix #2779: Erroneous pixiv_id parsed for novel/background/profile images 2016-12-04 02:04:44 -06:00
Albert Yi
7aab50f726 remove old iqdb code 2016-12-02 13:21:56 -08:00
Albert Yi
ebedea99c1 fix urls for iqdb service 2016-11-30 15:20:26 -08:00
Albert Yi
428d4689d6 stub in support for iqdbs 2016-11-28 17:14:25 -08:00
Albert Yi
8ccc7c2251 Merge pull request #2777 from evazion/feat-normalize-yandere-sources
Normalize yande.re sources from image URL -> html page URL.
2016-11-28 12:03:40 -08:00