Commit Graph

24 Commits

Author SHA1 Message Date
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
b5bf9b8678 post.rb: remove assorted unused methods. 2017-02-06 19:07:03 -06: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
86af580445 increase random post mod queue length to 12 2016-10-17 15:53:51 -07:00
evazion
bd6ebceda3 Refactor post_approvers_only to approver_only.
Don't duplicate code with post_approvers_only; use the approver_only?
method dynamically defined in `User::Roles.each do ... end`.
2016-10-14 05:04:40 +00:00
r888888888
62582cb994 remove false constraint 2016-09-13 01:14:32 -07:00
r888888888
76c1712989 account for nothing left to moderate 2016-09-12 16:20:08 -07:00
r888888888
5d1bc8726a make moderated cookie permanent 2016-09-12 13:06:09 -07:00
r888888888
2c80d7b82e more intelligent notice for mod queue 2016-09-09 15:08:23 -07:00
r888888888
1682196490 fix role 2016-09-08 16:02:51 -07:00
r888888888
de34c7fca3 fixes #2650: Add random mode to mod queue 2016-09-08 15:55:06 -07:00
Toks
fc34ea42d8 fixes #2453, Remember customized per page across browser sessions 2015-08-09 10:25:40 -04:00
r888888888
dedca83e7f fixes #2453: Customize per page pagination limit for mod queue 2015-08-04 17:43:53 -07:00
r888888888
66fe24d8c5 fixes #2452: status: metatag doesnt work in mod queue search 2015-07-24 13:51:19 -07:00
r888888888
d361be4ccd fixes #2453: Customize per page pagination limit for mod queue 2015-07-24 13:47:24 -07:00
r888888888
74728ad992 fixes #2445: Paginate mod queue 2015-07-21 15:56:55 -07:00
r888888888
1d9596d7f2 fixes #2417 2015-06-29 18:17:59 -07:00
r888888888
aab03422bc performance tweaks for rails 4.1 2014-04-24 22:24:42 -07:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
38f75961f6 improve mod queue 2013-02-22 21:33:11 -05:00
albert
26b5f3091c add hilighting to mod queue 2013-02-22 15:47:36 -05:00
albert
a39d5bc19e reverted post thumbnail change, fix for mod queue 2012-03-13 18:39:20 -04:00
albert
0229dbc711 updated mod queue 2011-10-26 18:16:29 -04:00
albert
a536a2699b * Renamed moderator/post/dashboard to moderator/post/queue
* Fixed bug with more overlay links being out of place if news listing is closed
2011-10-26 18:00:48 -04:00