Albert Yi
441022960a
Merge pull request #2968 from evazion/fix-wiki-rename
...
Fix #2964 : prevent renaming wikis with non-empty tags.
2017-04-10 14:53:33 -07:00
evazion
1b572c592c
wikis: disallow renaming unless tag is empty ( fix #2964 ).
2017-04-10 16:40:42 -05:00
r888888888
75bca7341b
remove status init on artist create
2017-04-10 14:30:34 -07:00
Albert Yi
0a45b99e33
Merge pull request #2966 from evazion/fix-artist-autocomplete
...
Improve autocomplete on /artists, /wiki_pages, and /pools.
2017-04-10 14:29:05 -07:00
evazion
8d45bb6d52
/post_{flags,appeals}: allow searching by tags.
2017-04-07 19:37:26 -05:00
evazion
652e251040
/post_{flags,appeals}: add uploader, approver, flag/appeal count columns.
...
Also include '»' links next to uploader/approver names for drilling down
the search by a given user.
2017-04-07 19:37:26 -05:00
evazion
3ae8cc5586
post_flags.rb: add 'rejected' and 'deleted' categories.
...
Includes a category field in /post_flags.json.
Adds 'rejected' and 'deleted' search categories. Categories:
* unapproved - deleted after going unapproved in first three days
* rejected - deleted after being manually flagged
* deleted - either of the above
* banned - artist requested removal
* normal - none of the above (a "normal" manual flag)
2017-04-07 19:37:26 -05:00
evazion
b9693827c3
/wiki_pages: sort autocomplete by post count.
...
* Add search[order]=post_count param to /wiki_pages.
* Make autocomplete do a prefix match ordered by post count, so that it
works the same way that tag autocomplete does elsewhere.
2017-04-07 18:25:31 -05:00
evazion
6b462c865e
/artists: sort autocomplete by post count.
...
* Add search[order]=post_count param to /artists.
* Make autocomplete do a prefix match ordered by post count, so that it
works the same way that tag autocomplete does elsewhere.
2017-04-07 18:25:31 -05:00
evazion
fbba167f0c
artist.rb: fix ambiguous column references.
...
Using `search[empty_only]=true` caused certain queries to throw an
exception due to ambiguous column references after joining on the tags
table.
Example:
https://danbooru.donmai.us/artists?search[empty_only]=true&search[name]=hammer *
PG::AmbiguousColumn exception raised
ERROR: column reference "name" is ambiguous LINE 1: ...ags"."name" = "artists"."name" WHERE (true) AND ((name LIKE ... ^
lib/danbooru/paginator/active_record_extension.rb:108:in `total_count'
lib/danbooru/paginator/active_record_extension.rb:63:in `block in paginate_numbered'
lib/danbooru/paginator/active_record_extension.rb:60:in `tap'
lib/danbooru/paginator/active_record_extension.rb:60:in `paginate_numbered'
lib/danbooru/paginator/active_record_extension.rb:15:in `paginate'
app/controllers/artists_controller.rb:41:in `index'
2017-04-07 18:25:31 -05:00
evazion
bb2f0ff795
/pools: make autocomplete use index.
...
`name ilike ?` doesn't use the index. Use `lower(name) like ?` instead.
2017-04-07 18:25:21 -05:00
Albert Yi
066aaf20c8
Merge pull request #2962 from evazion/fix-services-not-implemented
...
Fail gracefully when attempting to use unconfigured features (#2954 )
2017-04-05 12:35:47 -07:00
evazion
086b520dcc
archives: raise exception if not configured.
2017-04-05 01:17:03 -05:00
evazion
c03aa79ece
Post#give_favorites_to_parent: wrap in transaction.
...
Ensure that if anything fails then the entire favorites move will be
rolled back.
2017-04-04 20:44:05 -05:00
evazion
40feeb2411
Post#give_favorites_to_parent: fix exception (fixup 77793759)
...
Forgot the `belong_to :user` association in 77793759 .
2017-04-04 20:42:31 -05:00
r888888888
b43b2eb275
optimization for TagAlias.to_aliased
2017-04-04 14:16:20 -07:00
r888888888
0801c80662
remove animated_gif and animated_png tags on create only #2960
2017-04-04 13:28:30 -07:00
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
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
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
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
evazion
0793beded9
alias_and_implication_list: refactor alias/implication lookup.
...
Add alias and implications associations to Tag. Use them in
alias_and_implication list instead of duplicating the alias/implication
lookup code.
2017-03-23 02:47:21 -05:00
r888888888
b3e3012a9c
link to upload advice thread for deleted posts
2017-03-22 16:33:14 -07:00
evazion
47ecf034a7
/posts/:id/events - fix exception when viewed by mod.
...
NoMethodError exception raised
undefined method `creator' for #<PostEvent:0x007f9a298e64d8> Did you mean? creator_id
app/views/post_events/index.html.erb:23:in `block in _app_views_post_events_index_html_erb__2088986421112502721_70150054247640'
app/views/post_events/index.html.erb:18:in `each'
app/views/post_events/index.html.erb:18:in `_app_views_post_events_index_html_erb__2088986421112502721_70150054247640'
app/controllers/post_events_controller.rb:6:in `index'
2017-03-21 17:17:18 -05:00
r888888888
23da9c6f89
fixes #2911
2017-03-21 13:56:48 -07:00
r888888888
70d057f8f3
move saved search option to sidebar
2017-03-20 16:19:15 -07:00
evazion
5ba1df5502
/posts/:id/events: list is_resolved correctly for appeals.
...
/posts/:id/events incorrectly lists appeals as always being resolved.
This is because events UNION together appeals and flags, which doesn't
quite work because for appeals is_resolved is a method, not an
attribute. is_resolved was hardcoded to true so it'd work in the UNION.
This changes PostEvent to be a wrapper object around PostFlag /
PostAppeal, instead of a UNION. PostEvent delegates everything to the
inner flag/appeals object, so that is_resolved works correctly.
Also, this incidentally fixes a problem with /posts/:id/event.xml not
serializing correctly.
2017-03-19 22:47:10 -05:00
r888888888
d22d655d43
fix Post#set_tag_counts
2017-03-17 19:10:55 -07:00
r888888888
f1ba075bea
support disable_cache for Tag.categories_for
2017-03-17 18:41:33 -07:00
r888888888
5cef0321f2
switch to use Cache.get_multi for tag types
2017-03-17 18:36:53 -07:00
r888888888
c3c4952e35
do not limit flags for system user
2017-03-17 12:17:27 -07:00
r888888888
ecdea34323
revert e7b3fae215
2017-03-17 12:13:27 -07:00
r888888888
bdeba94b31
fix error case in saved search
2017-03-16 15:17:55 -07:00
r888888888
e7b3fae215
change daily flag limit to 5/day
2017-03-16 14:32:04 -07:00
r888888888
d9a26975ba
fix tests
2017-03-15 16:08:47 -07:00
r888888888
da06bee0ab
revamp saved search implementation
2017-03-15 15:36:48 -07:00