Commit Graph

62 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
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
BrokenEagle
5b4ab8d80e Disallow a user from seeing flagger's name on own uploads 2017-11-08 00:37:16 -08:00
r888888888
d4c89bccfc potential fix for #3189 2017-06-29 13:09:33 -07:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
Albert Yi
f780b32012 Merge pull request #3145 from r888888888/flagger_metatag
Add "flagger:" and "appealer:" metatags (fixes #3142)
2017-06-14 11:02:08 -07:00
Type-kun
d4944d6c11 Avoid using creator_id as a local variable in flag model 2017-06-14 20:56:02 +05:00
Type-kun
1375cc5307 Added privilege check for seeing flagger usernames
Also reworked all places dealing with flagger names to use said privilege
2017-06-14 20:43:25 +05:00
r888888888
d9ea925f4e add support for searching for dup-related flags 2017-06-12 15:25:07 -07:00
r888888888
6eb5a4c017 fixes #3096 2017-05-30 12:13:08 -07:00
evazion
02b3622f12 api: allow search[*_id] params to accept lists of ids in more places. 2017-05-23 15:45:40 -05:00
evazion
2259506bc2 flags: disallow flagging pending posts. 2017-05-19 14:37:38 -05:00
evazion
3570ace017 flags: ignore flagging rate-limits when deleting posts. 2017-05-17 23:48:37 -05:00
evazion
31a38ea39a flags: add flag cooldown test. 2017-05-04 17:37:59 -05:00
evazion
3b37bb6142 flags: add 3 day flagging cooldown period. 2017-05-04 16:51:49 -05:00
evazion
9f64857719 flags: move status locked check to post_flag.rb. 2017-05-04 16:51:49 -05:00
evazion
54b4a2e0c5 /post_{flags,appeals}: default to fulltext search for reason field. 2017-04-16 21:15:23 -05:00
evazion
8d45bb6d52 /post_{flags,appeals}: allow searching by tags. 2017-04-07 19:37:26 -05:00
evazion
652e251040 /post_{flags,appeals}: add uploader, approver, flag/appeal count columns.
Also include '»' links next to uploader/approver names for drilling down
the search by a given user.
2017-04-07 19:37:26 -05:00
evazion
3ae8cc5586 post_flags.rb: add 'rejected' and 'deleted' categories.
Includes a category field in /post_flags.json.

Adds 'rejected' and 'deleted' search categories. Categories:

* unapproved - deleted after going unapproved in first three days
* rejected   - deleted after being manually flagged
* deleted    - either of the above
* banned     - artist requested removal
* normal     - none of the above (a "normal" manual flag)
2017-04-07 19:37:26 -05:00
r888888888
c3c4952e35 do not limit flags for system user 2017-03-17 12:17:27 -07:00
r888888888
ecdea34323 revert e7b3fae215 2017-03-17 12:13:27 -07:00
r888888888
e7b3fae215 change daily flag limit to 5/day 2017-03-16 14:32:04 -07: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
Type-kun
d5fb37f675 Display flag creator ID in API for Mod+
Completely fixes #2640
2016-08-26 23:18:11 +05:00
r888888888
f5ee618342 fixes #2640: Change some API representations 2016-08-22 10:41:34 -07:00
Toks
aa936a1cac Fix not being able to see list of your own flags
fixes #2535
2015-10-12 10:05:23 -04:00
r888888888
1d9596d7f2 fixes #2417 2015-06-29 18:17:59 -07:00
Toks
38f51306a8 fix #2314 and appeals 2014-11-30 16:10:17 -05:00
Toks
095d02414c Exempt deletions from dupe flag checking 2014-10-31 20:01:42 -04:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
Toks
adc3efb539 Update flag/appeal searches and profile 2013-08-21 13:36:20 -04:00
Toks
249ab23da5 fixes #1930 2013-08-13 13:33:25 -04:00
Toks
36ce1f49ee Add unapproved flagged reason to flag search 2013-08-10 12:51:03 -04:00
Toks
27e54c3f3c Fix username searches 2013-08-10 12:49:25 -04:00
Toks
7c11fd440b Add pseudo-category search for flags
fixes #1915
2013-08-04 11:44:17 -04:00
r888888888
df9c087e85 fixes #826 2013-08-02 16:55:30 -07:00
r888888888
9df5952778 typo fix 2013-05-29 13:21:24 -07:00
Toks
c60a5fcc31 add resolved search for flags 2013-05-25 21:32:24 -04:00
Toks
ab6e9ce722 Revert "fixes #1327"
This reverts commit 96a468b51a.
2013-05-05 21:19:26 -04:00
Toks
96a468b51a fixes #1327 2013-04-14 18:48:55 -04:00
albert
85a5fcc658 fixes #1133 2013-03-29 16:45:59 -04:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
419aa1cedf potential fix for #919 2013-03-17 20:58:40 -04:00
albert
6b02826405 fix post flag 2013-03-10 16:48:56 -04:00
albert
60e7ef536c fixes #826 2013-03-10 16:38:34 -04:00