Commit Graph

83 Commits

Author SHA1 Message Date
Albert Yi
72f319ccf3 rename lambda references to use shorthand syntax 2018-05-10 11:18:02 -07:00
evazion
216d735f24 Fix #3696: API: handle boolean params consistently
* Use ApplicationRecord#attribute_matches to handle boolean attributes
  consistently in search methods.

* Add support for searching various boolean attributes that previously
  weren't supported.
2018-05-03 19:57:14 -05: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
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
BrokenEagle
85f04a826a Added additional mod actions 2018-01-14 00:07:20 -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
Type-kun
b3cd93a75c Fixes #3122 2017-06-07 21:19:53 +05:00
evazion
1d62ea3220 /forum_topics: don't list stickies first in json/atom responses. 2017-06-04 16:14:55 -05:00
evazion
8988f9cde8 /forum_topics.json: add search[id]=<ids> param. 2017-05-23 15:27:15 -05:00
evazion
71a19c28f1 forum topics: don't record a topic visit for api requests. 2017-05-13 13:50:20 -05:00
r888888888
48e9856f37 fixes #3007: Eliminate Janitor role 2017-05-01 14:38:30 -07:00
r888888888
7f2ad3c80b validate max length of forum topic 2017-03-06 15:13:30 -08:00
r888888888
e699684c61 add css for highliting a specific forum post 2017-02-21 13:40:52 -08:00
evazion
ec653dce71 app/presenters: remove unused forum_post/note/post_version presenters. 2017-02-06 19:07:02 -06:00
r888888888
98b305b4db add link to mod+ topics 2017-01-24 13:13:13 -08:00
evazion
1cce721114 Fix #2772: Topics set as mod+ can't be reverted to public ones. 2016-11-28 05:50:46 -06:00
evazion
daf1324ab2 Refactor available_min_user_levels to view helper. 2016-11-28 01:36:59 -06:00
Albert Yi
eb6746a8a8 additional checks on forum topic visibility 2016-11-07 10:48:04 -08:00
evazion
5d54ba5096 Fix listing private topics in /forum_posts.
Fix an exploit allowing viewing of private topics with

  http://danbooru.donmai.us/forum_posts
2016-10-30 18:00:26 -05:00
Albert Yi
60eebd9608 fix chaining of hidden_attributes/method_attributes 2016-10-27 14:53:25 -07:00
Albert Yi
79842f7a3b restrict min level constraints for forum topics to mod+admin and restrict options based on current user's level. check privileges for visiblity in forum posts and topics. deprecate serializable_hash (undocumented, internal) for as_json, refactor to use hidden_attributes and method_attributes #2658 2016-10-25 15:05:55 -07:00
Albert Yi
589df5f301 implements #2658: private forum topics 2016-10-24 16:56:18 -07:00
r888888888
34aa777aad fixes #2531: Topic merge should update updater_id 2015-10-26 12:55:42 -07:00
r888888888
6480864718 fixes #2469 2015-10-15 15:24:24 -07:00
r888888888
7215a39d98 fixes #1903: First post of forum topic doesn't show "updated by" message 2015-08-07 11:23:21 -07:00
Toks
0691477a3b Fix forum deletions 2015-07-15 00:40:58 -04:00
Toks
fe7f3d8204 Keep track of who deletes forum post/topic/comment
Previously it would look like the creator of it was the one who
deleted/undeleted it, even if it was someone else.
2015-07-11 13:20:47 -04:00
Toks
b3a665d096 #2417 remove janitor from mod-only attr_accessible 2015-06-30 12:59:39 -04:00
r888888888
1d9596d7f2 fixes #2417 2015-06-29 18:17:59 -07:00
Toks
7c2ce325a3 fix #2403, remove unused code 2015-06-08 17:34:13 -04:00
Toks
c8b41b4045 Forum activity indicator: don't count deleted topics as unread 2015-05-02 09:44:16 -04:00
Toks
8b2b981b80 fixes #2229 2015-01-19 14:26:25 -05:00
Toks
2ee548dc85 Fix topic merge
It was merging in the wrong direction, and didn't update response count.
2014-11-12 01:20:27 -05:00
r888888888
2b96040a30 fixes #2191 2014-08-12 17:03:16 -07:00
r888888888
bb402f5a27 fixes #2197 2014-07-17 16:34:54 -07:00
r888888888
a6d69e63be fixes #2197 2014-07-17 16:24:03 -07:00
r888888888
82c08c9faf fixes #2192 2014-06-16 17:04:26 -07:00
r888888888
e41d4badb9 remove debug statements 2014-06-12 21:50:49 -07:00
r888888888
58a0086e69 potential fix for #2192 2014-06-12 21:41:37 -07:00
Toks
53134c0d19 Revert 57f82182a8 2014-05-30 14:21:18 -04:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
r888888888
7edcbf33dd fixes #2108, upgrade to postgresql 9.3, fix tests 2014-04-11 14:15:14 -07:00
Toks
57f82182a8 Potential improvement for #read_by? 2014-03-29 21:27:46 -04:00
Toks
8541d2896a #1469: Fix issue with topics getting marked as read erroneously
It looks like it would set last_forum_read_at to the oldest unread
topic's updated_at value. But then it would fail to include that same
topic in the query next time because it used > instead of >=.
2014-03-26 14:21:34 -04:00
r888888888
4f6a48d773 #1469: add condition for when all forum topics are read 2014-03-19 13:08:26 -07:00
r888888888
95b05cae76 #1469 more intelligent updating of last_forum_read_at 2014-03-19 12:51:22 -07:00
r888888888
de34d21f76 fixes #1289 2014-03-18 11:21:10 -07:00
r888888888
7e07b874a4 implementation for #1469
This reverts commit 18edc937fd.
2014-03-14 18:39:31 -07:00
r888888888
18edc937fd Revert "implementation for #1469"
This reverts commit 08b9b2771f.
2014-03-10 16:31:38 -07:00