Commit Graph

477 Commits

Author SHA1 Message Date
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
evazion
f9aeb875db Normalize yande.re sources from image URL -> html page URL. 2016-11-28 05:04:02 -06:00
evazion
0697af6d23 Fix #2771: Approving deleted image doesn't create mod action. 2016-11-28 02:50:07 -06:00
evazion
f02a31a447 Autotag character_(cosplay) -> character, cosplay.
Make e.g. hatsune_miku_(cosplay) automatically add hatsune_miku and cosplay.

Perform autotagging after aliasing so that *_(cosplay) aliases (e.g.
hestia_(dungeon)_(cosplay) -> hestia_(danmachi)_(cosplay)) can take
effect first.
2016-11-04 23:37:28 -05:00
Albert Yi
91793fff82 fixes #2731: Expunged posts should clear favorite groups 2016-11-01 13:44:36 -07:00
Albert Yi
2dbb869188 keep track of post approvals to prevent approval cycles 2016-10-31 17:51:44 -07:00
Albert Yi
60eebd9608 fix chaining of hidden_attributes/method_attributes 2016-10-27 14:53:25 -07:00
evazion
8672604ee7 Add upvote:/downvote: editing metatags. 2016-10-26 23:23:47 -05:00
evazion
8b5aac7808 Add locked:{notes,status,rating} editing metatags (fix #1716). 2016-10-26 23:23:09 -05: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
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
evazion
c6294d5dfd Resolve aliases when removing negated tags (fix #2730). 2016-10-21 23:39:35 -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
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
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
c46b31aa9c Prevent reverting to foreign versions (fixes #2711). 2016-10-11 06:57:46 +00:00
evazion
3838167dc0 Post#unvote!: Return correct score (fixes #2709).
vote.destroy sets the score in the database but not on the in-memory
post. So just reload the post from the db to get the updated score,
don't duplicate the logic of setting it again.
2016-10-08 09:07:41 +00:00
evazion
ab5fd48280 Prevent mass assignment to Post#last_noted_at (#2704). 2016-10-06 09:39:57 +00:00
evazion
d38e83cd00 Refactor Post#parse_pixiv_id to use illust_id_from_url (fix #2695).
* Make illust_id_from_url a public class method instead of a protected
  instance method so that Post#parse_pixiv_id can use it.
* Also make illust_id_from_url swallow the exception that
  illust_id_from_url! throws so that parse_pixiv_id can use it.
2016-10-03 02:29:45 +00:00
Type-kun
02b8f37515 Allow source:"text with spaces", also allow source: for post edit 2016-09-19 19:33:21 +05:00
Type-kun
62773852f7 Add automatic APNG detection (#2237) 2016-09-08 00:48:39 +05:00
r888888888
52a2add18c add check if google apis are enabled 2016-08-22 16:10:20 -07:00
r888888888
0a65302f12 remove uniqueness constraint on postupdates 2016-08-22 16:09:20 -07:00
r888888888
3c42df51c9 add framework for post update pushes to pubsub 2016-08-19 17:51:47 -07:00
r888888888
28aa7f30d5 disable pubsub 2016-08-13 10:35:38 -07:00
r888888888
a55aa73b25 remove debugging 2016-08-12 13:35:11 -07:00
r888888888
1974db27b6 consolidate update_column calls on posts 2016-08-12 13:34:02 -07:00
r888888888
ba5e43d127 updated rules about self artwork 2016-08-12 11:39:55 -07:00
r888888888
7026e11adc fixes #2623: bugs with art commentary tags 2016-07-28 15:53:23 -07:00
r888888888
5cd1a34700 add google pubsub integration 2016-07-27 17:20:48 -07:00
r888888888
35a6f60dc4 add options for modifying commentary/commentary_request tags on form #2623 2016-07-19 16:49:19 -07:00
r888888888
37bc7279e3 fixes #2622: Create a source normalization rule for the HTTPS version of pixiv.net 2016-07-18 17:18:56 -07:00