Commit Graph

4936 Commits

Author SHA1 Message Date
evazion
e67194c19d Set approver when creating banned_artist implication. 2016-10-26 21:52:19 -05:00
evazion
1e9bcf75de Test banning artist sets approver of banned_artist implication. 2016-10-26 21:52:19 -05:00
evazion
6dd8ec909d Set approver of aliases/implications in BURs.
Previously only the BUR's approver was set when a BUR was approved. Set
the approver for each alias/implication in the BUR as well.

Additionally:

* Refactor `approve!` to take a user instead of just a user id.
* Be mass-assignment permissions aware when setting approver_id.
2016-10-26 21:52:19 -05:00
evazion
1e8a68a56b Test that approving BUR sets approver of aliases/implications. 2016-10-26 21:52:18 -05:00
evazion
abbf834256 Merge wiki conflict and tag alias approval forum posts (#2715).
* Attribute the "tag alias has conflicting wiki pages" message to the
  alias approver, not to the first admin.
* Merge the conflict message and alias approval message into one forum post.
* Fix an error with NewRelic gem not installed in test environment.
2016-10-26 21:52:15 -05:00
Albert Yi
24d44dd4f8 fix tests, better error handling in pixiv ugoira converter 2016-10-25 16:20:47 -07:00
Albert Yi
79842f7a3b restrict min level constraints for forum topics to mod+admin and restrict options based on current user's level. check privileges for visiblity in forum posts and topics. deprecate serializable_hash (undocumented, internal) for as_json, refactor to use hidden_attributes and method_attributes #2658 2016-10-25 15:05:55 -07:00
Albert Yi
ae61cc8a40 Merge pull request #2737 from evazion/fix-link-rules
Link self-upload disclaimer on /uploads; link howto:flag in flag notices.
2016-10-24 17:23:50 -07:00
Albert Yi
4926db7e42 Merge pull request #2738 from evazion/fix-danbooru-references
Replace references to "Danbooru" with <%= Danbooru.config.app_name %>
2016-10-24 17:19:38 -07:00
evazion
fd4eb8fa08 Replace references to Danbooru with Danbooru.config.app_name.
* Also replace references to github with a configurable repo.
* Plus link commit ref in footer to the commit in the repo.
2016-10-24 19:07:19 -05:00
evazion
58ef469a76 Link current commit if running inside a git repo.
Useful when running `rails server` straight from a dev repo.
2016-10-24 19:07:08 -05:00
Albert Yi
589df5f301 implements #2658: private forum topics 2016-10-24 16:56:18 -07:00
evazion
5e3393817f Link to howto:flag in flag notice. 2016-10-24 18:52:01 -05:00
evazion
13d4474818 Add self-uploading disclaimer to uploads page. 2016-10-24 18:52:01 -05:00
Albert Yi
0757f201a0 Merge pull request #2735 from evazion/fix-whitecube-bookmarklet
Fix upload bookmarklet for Pixiv whitecube URLs.
2016-10-24 12:21:36 -07:00
Albert Yi
f158e10c37 Merge pull request #2734 from evazion/fix-negated-aliases
Resolve aliases when removing negated tags (fix #2730)
2016-10-24 12:21:21 -07:00
Albert Yi
95c3f5342a Merge pull request #2733 from evazion/fix-tag-normalization
Fix metatag editing so that rating:s obeys rate locks, source:blah updates pixiv id
2016-10-24 12:18:41 -07:00
Albert Yi
e8336afd81 fixes #2718: Twitter artist finding should not be case sensitive 2016-10-24 12:18:44 -07:00
evazion
f94dfbf17e Fix bookmarklet for whitecube URLs.
Make the bookmarklet work for URLs like this:

* http://www.pixiv.net/whitecube/user/607414/illust/59510800
* http://www.pixiv.net/whitecube/user/772090/illust/59595705
2016-10-22 16:11:44 -05:00
evazion
c6294d5dfd Resolve aliases when removing negated tags (fix #2730). 2016-10-21 23:39:35 -05:00
evazion
52491f4486 Fix @artist.ban! test case.
Must use an admin in this test now because admin privileges are needed
to create the `banned_artist` tag implication.

(fixes regression in 7e3284c)
2016-10-21 19:59:02 -05:00
evazion
8b46726166 Fix tests for before_validation :normalize_tags.
`update_attribute` doesn't trigger `before_validation` callbacks, which
is where metatag processing happens. `update` or `update_attributes`
must be used instead.

AFAIK the test suite is the only place where `post.update_attribute(:tag_string => "stuff")`
is used, the actual code doesn't use it.
2016-10-21 19:59:02 -05:00
evazion
07921d2c88 Make rating:s obey rate locks; make source:blah update pixiv id.
Move normalize_tags (which processes metatags) from before_save to
before_validation. This is so that it runs as early as possible, before
strip_source / parse_pixiv_ids / updater_can_change_rating, so these
callbacks can handle source/rating changes from metatags.

Fixes a couple bugs:

* Ratings locks were ignored when using rating:s metatag (regression in 0006b76)
* Pixiv ids weren't updated when using source:blah metatag.

Note: this means that `post.update_attribute(:tag_string => "art:bkub)`
is now wrong. This is because update_attribute runs callbacks but not
validations, so it doesn't process metatags from the tag string.
`update` or `update_attributes` must be used instead.
2016-10-21 19:59:02 -05:00
evazion
899f008c1d Reorganize Post callbacks into calling order.
Reorder callbacks into the same order Rails runs them in:

* before_validation
* validate
* before_save
* before_create
* after_create
* after_save
* after_commit

This doesn't change the behavior of anything, it simply rearranges
callbacks so their running order is less confusing.
2016-10-21 19:59:01 -05:00
evazion
0b7cd71d42 Add some tests for tagging posts with metatags.
Exercise a few bugs:

* rating:safe should obey on rating locks.
* source:blah should update the pixiv id.
* source:"  foo bar baz  " should trim leading/trailing whitespace.

The other tests are for metatags that work but didn't have tests.
2016-10-21 19:59:01 -05:00
Albert Yi
080eecb6b9 Merge pull request #2729 from evazion/fix-notes-mass-assignment
Fix vuln allowing users to move notes between posts.
2016-10-20 16:22:43 -07:00
Albert Yi
8d2b1cf2b5 Merge pull request #2727 from evazion/fix-post-ratings
Validate post ratings and fix ratings locks
2016-10-20 10:32:40 -07:00
evazion
8df1496d28 Fix vuln allowing users to move notes between posts.
Prevents this from working:

    PUT /notes/1.json?note[post_id]=23
    PUT /notes/1.json?note[post_id]=42
2016-10-19 22:54:47 -05:00
evazion
d2f3027294 Add test for moving notes between posts. 2016-10-19 22:54:39 -05:00
evazion
0006b76c4d Always obey rating locks; make rerating locked posts an error.
Currently rating locks are only obeyed when using the rating: metatag.
They aren't obeyed when:

* Changing the rating via the API.
* Changing the rating via 'Rate Safe' in the mode menu (uses the API).
* Reverting to previous versions.

Also, the current behavior is to ignore the rating: metatag if the post
is locked. This patch instead makes the update fail completely (note that
this could affect trying to mass revert posts that may be rating locked).

Note: the check for `!is_rating_locked_changed?` is so that

  PUT /posts/1.json?post[rating]=s&post[is_rating_locked]=true

works (ie., locking and changing the rating at the same time is okay).
2016-10-19 20:06:43 -05:00
evazion
88248e7ec7 Add tests for reverting rating-locked posts. 2016-10-19 20:06:43 -05:00
evazion
c01e03b193 Validate post ratings.
Prevent ratings from being set to invalid values via the API:

    PUT /posts/1.json?post[rating]=Z
2016-10-19 20:06:43 -05:00
evazion
d2a0b089f4 Add test for setting invalid ratings. 2016-10-19 20:06:43 -05:00
Albert Yi
4c1949f1c8 add PATCH 2016-10-19 14:41:59 -07:00
Albert Yi
25028f0c7f increase api limit for platinum 2016-10-19 13:00:36 -07:00
Albert Yi
af55e6cf8a fix api limit display 2016-10-19 10:39:01 -07:00
Albert Yi
fb1cf5edbc Merge pull request #2726 from evazion/feat-log-tag-aliases+implications
Log tag aliases+implications
2016-10-19 10:07:08 -07:00
Albert Yi
4b8d014b2f fixes #2718: Twitter artist finding should not be case sensitive 2016-10-18 16:51:59 -07:00
Albert Yi
7cad4a3f68 normalized artist urls are always downcased 2016-10-18 16:32:35 -07:00
Albert Yi
e78b7d2a8c fixes #2716: Wiki pages should be undeletable 2016-10-18 15:45:50 -07:00
Albert Yi
2a5343b8cf add more intelligent js for artist forms 2016-10-18 14:56:40 -07:00
Albert Yi
2424f24fcd return 429 for too many requests instead of 421 2016-10-18 13:33:04 -07:00
Albert Yi
b17cd5bffc fix for sessionless api limits 2016-10-18 13:04:50 -07:00
evazion
29f3aef6b6 Log all tag alias/implication changes.
Creates a mod action any time an alias or implication is changed. This
includes creations, edits to pending aliases/implications, deletions,
and approvals. Also it logs each status change from pending -> queued
-> processing -> approved.

Call are changed from `update_column` to `update` so that the
create_mod_action callback will run at every point in the lifecycle.
2016-10-18 05:23:27 -05:00
evazion
5743166e25 Add a test case for implication requests. 2016-10-18 05:22:44 -05:00
r888888888
afa0dcae20 potential fix for alias/implication status bug 2016-10-18 00:25:55 -07:00
Albert Yi
87447a51c3 work on #2693 Separate API Limits by Writes/Reads 2016-10-17 16:37:11 -07:00
Albert Yi
ced7a34afa additional fixes for install script 2016-10-17 16:15:12 -07:00
Albert Yi
86af580445 increase random post mod queue length to 12 2016-10-17 15:53:51 -07:00
Albert Yi
c36d58f5f5 Merge pull request #2722 from evazion/fix-2721
Fix missing JSON/XML templates, make more pages public (#2721)
2016-10-17 14:47:01 -07:00