evazion
1b572c592c
wikis: disallow renaming unless tag is empty ( fix #2964 ).
2017-04-10 16:40:42 -05:00
evazion
2d2efbddfe
/iqdb_queries: add api test.
2017-04-05 18:48:57 -05:00
r888888888
0b8d4105aa
fix tests
2017-04-04 12:39:17 -07:00
evazion
777937591e
Post#give_favorites_to_parent: move hidden favs.
2017-04-03 22:36:20 -05: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
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
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
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
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
022d9ede7f
expose bulk revert interface
2017-03-21 14:40:46 -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
ecdea34323
revert e7b3fae215
2017-03-17 12:13:27 -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
43f31529d7
fixes #2920 : "Undo" function not working for Post Versions
2017-03-09 11:44:28 -08:00
evazion
02122343c3
dmails: don't default IP addr to 127.0.0.1 in database ( fixes #2908 ).
...
Bug introduced in 1400f64; that commit changed dmails so that
creator_ip_addr defaulted to CurrentUser.ip_addr like this:
after_initialize :initialize_attributes, if: :new_record?
def initialize_attributes
self.from_id ||= CurrentUser.id
self.creator_ip_addr ||= CurrentUser.ip_addr
end
...but creator_ip_addr already defaulted to 127.0.0.1 from the database,
so the ||= assignment didn't work. Remove the database default so we
always default to CurrentUser.ip_addr.
2017-03-01 19:51:48 -06:00
Albert Yi
fd7cddc909
Merge branch 'master' into fix-mention-dmails
2017-02-27 17:00:24 -08:00
Albert Yi
1fa0aabbe0
Merge pull request #2896 from evazion/fix-username-whitespace
...
Disallow unicode whitespace in usernames (#2894 ).
2017-02-27 16:47:44 -08:00
r888888888
398f58684f
Merge branch 'post-archive'
2017-02-27 10:45:13 -08:00
evazion
46280f2227
mentions: include mentioner in subject line.
...
The template looks like this:
Subject:
#{creator_name} mentioned you in a comment on post ##{post_id}
Body:
@#{creator_name} mentioned you in a \"comment\":/posts/#{post_id}#comment-#{id} on post ##{post_id}:
[quote]
#{DText.excerpt(body, "@"+user_name)}
[/quote]
2017-02-25 23:05:44 -06:00
evazion
6e3ddb6ed6
dmails: don't save copies of outgoing dmails sent by DanbooruBot.
...
There's not much sense in saving copies of everything DanbooruBot sends
in DanbooruBot's inbox. They probably won't be checked so it just bloats
the dmails table.
2017-02-25 23:05:44 -06:00
evazion
6966b74e18
Disallow unicode whitespace in usernames ( #2894 ).
2017-02-25 01:51:33 -06:00
evazion
6704e71377
dmails: add tests for automated dmails.
2017-02-23 22:51:17 -06:00
evazion
d852f98e4f
/dmails: remove unused search[owner_id] param.
...
/dmails is restricted to viewing dmails for CurrentUser only (due to
Dmail.visible in the index action). Remove owner_id from subnavbar links
in /dmails, and don't support it in /dmails?search[owner_id], since it
doesn't actually do anything.
Also removes related dead methods and fixes tests that didn't test owner_id properly.
2017-02-23 22:51:17 -06:00
r888888888
6bd03ee4db
fix tests
2017-02-21 15:04:55 -08:00
Albert Yi
5404c1d231
implement postarchive
2017-02-21 13:40:52 -08:00
r888888888
6c9d5e4f9a
remove advertisement code
2017-02-21 13:35:22 -08:00
evazion
d78c537ec2
Add user mailer previewer.
...
Usage: open /rails/mailers in your browser.
2017-02-18 03:10:49 -06:00
r888888888
291e9acdc7
fixes #2885 : "Is Deleted" not being recorded correctly for Wiki Page Versions
2017-02-15 15:32:41 -08:00
evazion
f971f927fd
post_test.rb: add tag name validation tests.
2017-02-08 23:31:30 -06:00
r888888888
c01f48f18c
mock pool archive service in post test
2017-02-07 14:14:36 -08:00
Albert Yi
b1c33f2379
Merge pull request #2878 from evazion/fix-test-coverage
...
Improve controller test coverage
2017-02-07 13:45:16 -08:00
r888888888
7a3d1c7d1d
dont download original artstation images if they dont exist
2017-02-07 13:40:19 -08:00
r888888888
39b6601afe
Merge branch 'artstation'
2017-02-06 17:07:57 -08:00
r888888888
7a2f652152
add source strategy for artstation
2017-02-06 17:07:09 -08:00
evazion
35b3398142
post_test.rb: add more metatag search tests.
2017-02-06 18:48:39 -06:00
evazion
cac5eae3c4
tests: add more tags controller/model tests.
2017-02-06 18:48:39 -06:00
evazion
2b4c722bd1
tests: add more notes controller tests.
2017-02-06 18:48:38 -06:00
evazion
0890c6320b
tests: add more comments controller tests.
2017-02-06 18:48:38 -06:00
evazion
73e274b2e0
tests: add more moderator/post/queues controller tests.
2017-02-06 18:48:38 -06:00
evazion
a120a63d3b
tests: add more moderator/post/posts controller tests.
2017-02-06 18:48:38 -06:00
evazion
cdafbc849d
tests: add more artist commentary controller tests.
2017-02-06 18:48:38 -06:00
evazion
2d62fff89b
tests: add more wiki page versions controller tests.
2017-02-06 18:48:37 -06:00
evazion
43591e0c2d
tests: add more wiki pages controller tests.
2017-02-06 18:48:37 -06:00
evazion
5c871aee64
tests: add more pools controller tests.
2017-02-06 18:48:37 -06:00