Commit Graph

42 Commits

Author SHA1 Message Date
Albert Yi
72f319ccf3 rename lambda references to use shorthand syntax 2018-05-10 11:18:02 -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
evazion
dac095f318 /user_feedbacks: change default order to created_at.
Order by created_at instead of by id because old feedbacks aren't in id order.
2018-02-04 16:43:00 -06:00
Albert Yi
47bd812811 Merge pull request #3525 from BrokenEagle/fix-index-default-order
Fix index default order
2018-01-29 13:11:24 -08:00
BrokenEagle
d829ab3a00 Move all order logic to models
- Have a default order for each model
-- The overall default is ID DESC
- Allow for custom orderings
-- When comma-separated IDs are used
2018-01-29 11:42:53 -08:00
evazion
100c1d2828 Fix #3523: Feedback notification dmails should include the text of the feedback. 2018-01-28 14:32:38 -06:00
BrokenEagle
3c45273694 Add category for mod actions 2018-01-13 20:55:52 -08:00
evazion
0ca726802f Fix #3430: Accept the search[id] param in all controllers.
* Allow every controller to take the `search[id]` param.

* Parse the `search[id]` param the same way that the `id:<N>` metatag is
  parsed. So `search[id]=1,2,3`, `search[id]=<42`, `search[id]=1..10`, for
  example, are all accepted.
2017-12-17 17:36:52 -06:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
evazion
94e548cfe1 /bans: add test for searching bans. 2017-04-19 17:56:26 -05:00
evazion
b1af644f67 dmails: send automated dmails from Danbooru.config.system_user.
Sends automated dmails from `Danbooru.config.system_user`, rather than
whichever user is performing the action happens to be (usually User.admins.first).

Also adds a notice in the view that the dmail was automated.
2017-02-23 22:51:17 -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
Type-kun
5ce26c2e52 Remaining fixes to mod actions on user feedbacks and IP bans 2017-01-16 18:21:09 +05:00
Type-kun
02c243b968 Revert to: "Another partial fix for issue #2824, which also affected ip bans and feedback" 2017-01-14 21:53:33 +00:00
Albert Yi
f2a5d45db0 implement token bucket rate limiting 2017-01-09 17:31:14 -08: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
Albert Yi
b9a1e115fb add additional mod actions 2017-01-03 16:02:36 -08:00
evazion
fa74c71b6d Prevent mods from editing/deleting feedbacks given to themselves. 2016-11-28 03:57:24 -06:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
r888888888
37d75e4a88 Fixes #1266 2014-03-05 17:53:26 -08:00
Toks
27e54c3f3c Fix username searches 2013-08-10 12:49:25 -04:00
Toks
cc17c9ce55 fixes #1560 2013-05-11 20:53:11 -04:00
r888888888
a031a4eba8 fix test 2013-05-07 13:27:21 -07:00
r888888888
d5f575159f rename references of privileged to gold 2013-04-28 00:04:52 -07:00
albert
85a5fcc658 fixes #1133 2013-03-29 16:45:59 -04:00
albert
48b1f63028 fixes #1041 2013-03-22 20:36:34 -04:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
bd316e2bbc fixes #674 2013-03-01 06:41:30 -08:00
albert
48953df07b fixes #673 2013-03-01 06:27:48 -08:00
albert
ad6ad8074e fixes #396 2013-02-19 14:10:13 -05:00
albert
e0fdda3103 fixes to model searches 2013-02-19 12:27:17 -05:00
albert
72b7651169 improved search methods 2013-01-11 17:13:55 -05:00
albert
8749c43b3e refactored search 2013-01-10 17:45:52 -05:00
albert
80f34d08d9 revert default scope change 2013-01-07 17:24:03 -05:00
albert
040059c491 add default scopes to every model 2013-01-07 17:12:43 -05:00
albert
c8bcf5ad7c updated to rails 3.2, fixed tests 2012-01-27 14:22:47 -05:00
albert
e42ea9c608 added popular exploration, added order:rank 2011-08-11 15:39:51 -04:00
albert
98403d0cb7 fix user feedback controller test 2011-07-17 18:40:24 -04:00
albert
8eb3451fb4 added user feedback functional test 2011-02-01 18:08:01 -05:00
albert
3d5873c182 some fixes to janitor trials, implemented jan trial controller test 2011-01-14 16:45:10 -05:00
albert
1a7197807a added user feedback test 2010-02-19 18:04:43 -05:00
albert
703eb6a1b6 added bans 2010-02-19 17:30:11 -05:00