Commit Graph

83 Commits

Author SHA1 Message Date
evazion
d73895312e Avoid swallowing exceptions unnecessarily. 2019-08-29 00:51:52 -05:00
evazion
dab43d96c9 jobs: migrate mass updates to ActiveJob.
Also fixes a bug where mod actions weren't logged on mass updates.
Creating the mod action silently failed because it was called when
CurrentUser wasn' set.
2019-08-19 00:46:31 -05:00
evazion
48488d04db jobs: migrate bulk reverts to ActiveJob. 2019-08-19 00:46:30 -05:00
evazion
576b4feb3b views: convert mod dashboard + admin user edit page to simple form.
Fixes bug with the user level select dropdown on the mod dashboard page
missing the builder level.
2019-08-18 11:24:42 -05:00
evazion
39bd766b34 Fix #4053: Add disapproval index improvements.
Add search form to /moderator/post/disapprovals.
2019-08-02 22:03:03 -05:00
Albert Yi
0a058dd52b fixes #4080: Status code 500 when disapproving through API 2019-05-17 12:09:03 -07:00
Albert Yi
33063a72de Add a listing page for post disapprovals (accessible to approvers only) 2019-01-24 16:14:57 -08:00
evazion
3dafca9aec Fix #3842: Mods can demote other mods or admins. 2018-08-25 13:52:50 -05:00
r888888888
4739c45da0 fixes #3729 2018-05-26 13:13:07 -07:00
Albert Yi
320f1a426e fixes #3704 2018-05-10 10:20:51 -07:00
r888888888
abce4d2551 Raise error on unpermitted params.
Fail loudly if we forget to whitelist a param instead of silently
ignoring it.

misc models: convert to strong params.

artist commentaries: convert to strong params.

* Disallow changing or setting post_id to a nonexistent post.

artists: convert to strong params.

* Disallow setting `is_banned` in create/update actions. Changing it
  this way instead of with the ban/unban actions would leave the artist in
  a partially banned state.

bans: convert to strong params.

* Disallow changing the user_id after the ban has been created.

comments: convert to strong params.

favorite groups: convert to strong params.

news updates: convert to strong params.

post appeals: convert to strong params.

post flags: convert to strong params.

* Disallow users from setting the `is_deleted` / `is_resolved` flags.

ip bans: convert to strong params.

user feedbacks: convert to strong params.

* Disallow users from setting `disable_dmail_notification` when creating feedbacks.
* Disallow changing the user_id after the feedback has been created.

notes: convert to strong params.

wiki pages: convert to strong params.

* Also fix non-Builders being able to delete wiki pages.

saved searches: convert to strong params.

pools: convert to strong params.

* Disallow setting `post_count` or `is_deleted` in create/update actions.

janitor trials: convert to strong params.

post disapprovals: convert to strong params.

* Factor out quick-mod bar to shared partial.
* Fix quick-mod bar to use `Post#is_approvable?` to determine visibility
  of Approve button.

dmail filters: convert to strong params.

password resets: convert to strong params.

user name change requests: convert to strong params.

posts: convert to strong params.

users: convert to strong params.

* Disallow setting password_hash, last_logged_in_at, last_forum_read_at,
  has_mail, and dmail_filter_attributes[user_id].

* Remove initialize_default_image_size (dead code).

uploads: convert to strong params.

* Remove `initialize_status` because status already defaults to pending
  in the database.

tag aliases/implications: convert to strong params.

tags: convert to strong params.

forum posts: convert to strong params.

* Disallow changing the topic_id after creating the post.
* Disallow setting is_deleted (destroy/undelete actions should be used instead).
* Remove is_sticky / is_locked (nonexistent attributes).

forum topics: convert to strong params.

* merges https://github.com/evazion/danbooru/tree/wip-rails-5.1
* lock pg gem to 0.21 (1.0.0 is incompatible with rails 5.1.4)
* switch to factorybot and change all references

Co-authored-by: r888888888 <r888888888@gmail.com>
Co-authored-by: evazion <noizave@gmail.com>

add diffs
2018-04-06 18:09:57 -07:00
r888888888
4e9ebbd02e include creator in bulk revert messages 2017-11-16 14:44:57 -08:00
r888888888
3356ef3457 scope bulk reverts to admin 2017-11-15 17:30:40 -08:00
r888888888
d29f2f6a13 fix bulk revert 2017-11-15 10:13:13 -08:00
r888888888
676a991bb2 fix path for bulk revert creation #3342 2017-10-25 18:08:52 -07:00
evazion
fdf8e7d5d7 Fix mode menu 'approve' option.
* Fix routing error in respond_with (didn't use /moderator namespace).

* Fix /moderator/posts/approvals.json response to return full
  PostApproval object, not just a success/failure message.

* Simplify the javascript a bit (use $.post instead of $.ajax).
2017-06-04 12:14:35 -05:00
evazion
565945ab7b flags: move flagging inside Post#delete! 2017-05-17 23:48:37 -05:00
evazion
648cc9ecb7 Move post replacement create action to post replacements controller. 2017-05-14 21:31:01 -05:00
evazion
df7cd67a7d post replacement: add POST /moderator/post/posts/replace endpoint. 2017-05-02 20:41:18 -05:00
evazion
70a7f77a48 Post#approve!: signal errors with invalid object instead of exception. 2017-04-03 17:18:32 -05:00
r888888888
bd3dfc73c0 fix queue for bulk reverts 2017-03-21 17:13:51 -07: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
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
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
2af622e7a7 add ban to post mode menu 2016-12-09 11:56:25 -08:00
Albert Yi
a22a7c3302 bulk revert 2016-11-07 10:48:04 -08:00
Albert Yi
4e48e80e1f stub in preview for bulk revert 2016-11-02 13:53:01 -07: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
r888888888
73d62bbc01 expose mod dashboard to all users 2016-08-30 15:14:46 -07:00
Toks
af22c2b7fa Display expunge errors #2556 2015-12-05 16:18:49 -05:00
r888888888
6480864718 fixes #2469 2015-10-15 15:24:24 -07:00
Toks
643ab7b2c6 ip search: add quick links & improve usability
#2530
2015-10-08 01:14:48 -04:00
Toks
2962cb80f1 #2495 move favorites
"Delete" already includes the ability to move favorites, this is just a
convenience function.
2015-08-20 21:06:27 -04:00
r888888888
767b11d4b5 fixes #2495: Post approvers can't delete/undelete/ban posts 2015-08-17 13:30:16 -07:00
Toks
fc34ea42d8 fixes #2453, Remember customized per page across browser sessions 2015-08-09 10:25:40 -04:00
r888888888
f66d5c3f02 fixes #2461: Mod queue comments 2015-08-05 13:11:32 -07:00
r888888888
dedca83e7f fixes #2453: Customize per page pagination limit for mod queue 2015-08-04 17:43:53 -07:00
r888888888
abb232d4e6 fixes #2448: Approvers can undelete posts they already approved/uploaded 2015-07-24 14:19:40 -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