Commit Graph

22 Commits

Author SHA1 Message Date
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
evazion
78aba1c5b1 Fix #3554: approving BUR with nil forum_post_id doesn't update forum.
Wrap `approve!` and `reject!` in transactions so that if there's an
error in approving or rejecting a BUR, it leaves the BUR's status
unchanged instead of updating the BUR but not updating the forum.
2018-02-24 15:04:57 -06:00
evazion
2b8767d7f4 BulkUpdateRequest#approve!: don't swallow exceptions.
Rescue `AliasAndImplicationImporter::Error` instead of `Exception`.
2018-02-24 14:37:02 -06:00
evazion
07d20f7cf0 Add test for category <tag> -> type bulk update requests. 2017-11-17 12:15:38 -06:00
r888888888
2c620f205b add tests to check if approver/rejector is mentioned in moderated bulk update requests 2017-11-16 11:41:07 -08:00
evazion
b5d602836c Don't send @mention dmails when updating forum after approving BURs. 2017-11-15 19:12:13 -06:00
evazion
f2351766c6 Fix #3374: List approver in BUR approval messages. 2017-11-15 19:12:12 -06:00
evazion
542c673221 Fix #3200: Disallow creation of superfluous implications.
Disallow transitive implications. If a -> b -> c already exists, don't
allow a -> c.

Caveat: if b -> c already exists, and we make a BUR for a -> b and a -> c,
the BUR validates even though a -> c is redundant. It only fails
when the BUR is approved.
2017-07-05 00:22:16 -05:00
evazion
614bf44086 /bulk_update_requests: add search form. 2017-05-23 17:23:32 -05:00
r888888888
113d8824d5 fix bur test 2017-04-19 14:04:36 -07:00
r888888888
19b8d41d09 refactor forum notifications for tag changes 2017-04-12 16:43:15 -07:00
evazion
beddc34958 tests: set Delayed::Worker.delay_jobs = false globally. 2017-02-04 17:18:51 -06: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
r888888888
58aa5c6d66 fix tests 2016-05-28 14:08:44 -07:00
r888888888
110569708e fix tests 2016-05-26 13:17:18 -07:00
r888888888
30415d9e1e add approver field to aliases/implications 2016-05-26 13:01:44 -07:00
r888888888
e6b16e8fe5 better validation for bulk update requests 2016-01-28 17:59:45 -08:00
r888888888
6ff02c653d dmail bulk update request errors to admin 2015-04-21 18:39:42 -07:00
r888888888
ee4c19a0dd improve bulk update req ui 2015-04-21 17:22:16 -07:00
r888888888
387dece55a update forum topic when alias/implication/update request is updated 2015-02-15 12:51:02 -08:00
r888888888
87ef2b8e0f fixes #2190 2014-06-16 17:29:35 -07:00