Commit Graph

822 Commits

Author SHA1 Message Date
evazion
d4b9b66c0e post_versions_controller.rb: fix N+1 queries in post, updater.
Rendering the updater name at post_versions/_listing.html:25 caused
this for each post version:

    SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1

PostArchive#diff caused this for each post version:

    SELECT "posts".* FROM "posts" WHERE "posts"."id" = $1 LIMIT 1
2017-03-02 17:47:20 -06:00
r888888888
5676978096 require membership to see post history 2017-03-01 16:29:00 -08:00
r888888888
12e4a82db3 fix upload tags report 2017-02-28 16:28:58 -08:00
r888888888
7f22baa1bc refactor upload tags report 2017-02-28 15:34:40 -08:00
Albert Yi
458a9692d6 Merge pull request #2864 from r888888888/upload_tags_report
Implement #2863: basic upload tags change report
2017-02-28 15:28:40 -08:00
Albert Yi
3780645cb2 Merge pull request #2897 from evazion/fix-rescue_from
Remove redundant rescue_from calls.
2017-02-27 16:48:44 -08:00
Albert Yi
27a85cd066 Merge pull request #2895 from evazion/fix-modqueue-dtext
modqueue: link tags, optimize sql, use dtext in disapproval reasons.
2017-02-27 16:47:19 -08:00
r888888888
398f58684f Merge branch 'post-archive' 2017-02-27 10:45:13 -08:00
evazion
40092f21ba Remove redundant rescue_from calls.
These are redundant because ApplicationController rescues these exceptions already.
2017-02-25 02:18:16 -06:00
evazion
83915a5d46 modqueue: avoid N+1 queries for disapprovals, uploaders.
Fixes an N+1 queries problem in the /moderator/post/queue view by
prefetching disapprovals and uploaders.

Also the way disapproval messages were previously rendered triggered a bunch
of sql queries for each post:

    SELECT COUNT(*) FROM "post_disapprovals" WHERE "post_disapprovals"."post_id" = $1 [["post_id", 52]]
    SELECT COUNT(*) FROM "post_disapprovals" WHERE "post_disapprovals"."post_id" = $1 AND "post_disapprovals"."reason" = $2  [["post_id", 52], ["reason", "breaks_rules"]]
    SELECT COUNT(*) FROM "post_disapprovals" WHERE "post_disapprovals"."post_id" = $1 AND "post_disapprovals"."reason" = $2  [["post_id", 52], ["reason", "poor_quality"]]
    SELECT COUNT(*) FROM "post_disapprovals" WHERE "post_disapprovals"."post_id" = $1 AND "post_disapprovals"."reason" IN ('disinterest', 'legacy')  [["post_id", 52]]
    SELECT COUNT(*) FROM "post_disapprovals" WHERE "post_disapprovals"."post_id" = $1 AND (message is not null and message <> '')  [["post_id", 52]]
    SELECT "post_disapprovals".* FROM "post_disapprovals" WHERE "post_disapprovals"."post_id" = $1 AND (message is not null and message <> '')  [["post_id", 52]]

This refactors to bring it down to one:

    SELECT "post_disapprovals".* FROM "post_disapprovals" WHERE "post_disapprovals"."post_id" = $1  [["post_id", 52]]
2017-02-24 21:03:14 -06:00
evazion
1400f64338 dmails_controller.rb: convert to strong params. 2017-02-23 22:51:17 -06: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
r888888888
f4d9f76646 remove contributors report 2017-02-21 13:12:43 -08:00
r888888888
ce20a5b36a remove janitor trial report 2017-02-21 13:10:38 -08:00
r888888888
359f48d871 remove user promotions report 2017-02-21 13:09:43 -08:00
r888888888
291e9acdc7 fixes #2885: "Is Deleted" not being recorded correctly for Wiki Page Versions 2017-02-15 15:32:41 -08:00
r888888888
f374eec4a1 fixes #2869: Add way to differentiate Pool Descriptions from Pool History 2017-02-14 16:03:19 -08:00
r888888888
aa41c41572 fixes #2876: Changing approver/contributor privileges should log mod action 2017-02-14 12:46:54 -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
23038de470 posts_controller.rb: remove unused /posts/home action.
Unused since a4911e3.
2017-02-06 19:07:03 -06:00
evazion
7e1f63de6a landings_controller.rb: remove unused /landing route.
Broken since PopularPostExplorer was removed in 7269ec0.
2017-02-06 19:07:03 -06:00
evazion
d74503ae05 tests: add misc controller tests. 2017-02-06 18:48:35 -06:00
Type-kun
1e8eceeba9 Implement basic upload tags change report 2017-01-27 18:28:15 +05:00
r888888888
1207faa600 fix tests 2017-01-24 16:05:06 -08:00
evazion
caaff24112 /comments?group_by=comment: add is_sticky/is_deleted/do_not_bump_post/order params. 2017-01-23 22:13:00 -06:00
evazion
7486bb0add Fix #2851: Account deletion should remove name change requests.
Hides name change requests for deleted users (username matches /user_[0-9]+~*/).
2017-01-19 22:32:13 +00:00
r888888888
bfa56a860c fixes #2415: "Random post" causes RecordNotFound exceptions 2017-01-18 14:12:12 -08:00
Albert Yi
bdac591266 fixes #2838 2017-01-16 12:57:43 -08:00
Albert Yi
a49394e6cd Merge pull request #2842 from evazion/fix-user-name-changes
Minor user name changes improvements.
2017-01-16 11:50:51 -08:00
Type-kun
6a6d16852a Final fix for #2658 - close exploit with "new". 2017-01-16 19:34:31 +05:00
evazion
d31a0c23f3 Name changes: add API endpoints for /user_name_change_requests. 2017-01-15 05:03:09 +00:00
evazion
9e9fdcb55d Name changes: make /user_name_change_requests member+; add reason/status/date. 2017-01-15 05:03:09 +00:00
evazion
66e30b323c Name changes: remove delete request button. 2017-01-15 05:03:08 +00:00
Albert Yi
0ab45ebc42 add postarchive model, fixes #2831: Replace Subscriptions Link With Search:All Link 2017-01-11 11:39:14 -08:00
Albert Yi
8db970f9f3 skip api check for forum and comment endpoints 2017-01-10 15:06:34 -08:00
Albert Yi
1724f89742 Merge pull request #2826 from r888888888/related-tags-html
Related tags html page (fixes #2750)
2017-01-09 18:11:22 -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
Albert Yi
f2a5d45db0 implement token bucket rate limiting 2017-01-09 17:31:14 -08:00
Type-kun
7c98c60129 Simple HTML page and form for related tags 2017-01-09 19:18:18 +05:00
Type-kun
9da5e67a65 Another partial fix for issue #2824, which also affected ip bans and feedback
Also fixed minor errors with IP bans
2017-01-09 13:57:16 +05:00
evazion
ef3f390bba Fix #2813: /posts/random.json does not redirect nicely. 2017-01-01 04:04:46 -06:00
Albert Yi
2fef0cdef9 Merge pull request #2804 from evazion/feat-comment-as-mod
Add option to comment as moderator (fix #2799)
2016-12-27 11:49:36 -08:00
Albert Yi
5c0836a9c8 Merge pull request #2803 from evazion/fix-comment-cleanups
Various minor comment code cleanups
2016-12-27 11:42:08 -08:00
evazion
cc215f6a41 Add more artist commentary API endpoints.
* GET /posts/1/artist_commentary.json
* GET /artist_commentaries/1.json
2016-12-27 06:01:22 +00:00
evazion
1257639109 Add 'post as moderator' option for comments.
* Add 'post as moderator' option to comment form. This creates a so-called sticky comment.
* Downvotes have no effect on stickied comments; they're always visible, regardless of comment thresholds.
* Only mods may sticky comments.
* Mods may sticky comments by other users.
2016-12-26 23:52:45 -06:00
evazion
69c50290a8 Include updater_name in /comments/1.json. 2016-12-26 23:52:27 -06:00
evazion
c165b38a91 Prevent anon users from attempting to undelete/unvote comments.
The :undelete and :unvote actions weren't covered.
2016-12-26 23:52:27 -06:00
evazion
00ddd2f5d4 Fix #2795: "check_availability" bug with saved searches. 2016-12-22 21:44:35 -06:00