Commit Graph

121 Commits

Author SHA1 Message Date
Albert Yi
79ea6f7e6c Add Docker and Travis config files to enable CI tests
Also fixes some Rails 6.0 deprecation warnings
2018-05-09 09:56:38 -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
3c45273694 Add category for mod actions 2018-01-13 20:55:52 -08:00
BrokenEagle
65eb94f8f9 Remove unused mod actions 2018-01-13 20:42:02 -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
r888888888
49a5b819bd eliminate ambiguities in pool search 2017-11-22 15:46:30 -08:00
BrokenEagle
956bd707a5 Add additional restrictions on updating deleted pools 2017-11-20 19:31:11 -08:00
r888888888
c83a76ccce fixes #3282 2017-09-14 11:07:14 -07:00
evazion
3b3abac8f6 pools: disallow asterisks and numeric-only names. 2017-08-10 18:37:22 -05:00
evazion
3b9a54f681 pools: strip leading/trailing, consecutive underscores in names (fix #3263). 2017-08-10 18:33:36 -05:00
evazion
fbee7f6912 Post#expunge!: fix remove_pool! to remove posts from deleted pools.
Don't silently ignore attempts to remove posts from deleted pools.
Remove the restriction on removing posts from deleted pools instead (ref: #1109).

Fixes failure to remove posts from deleted pools during expungement.
2017-07-21 00:13:20 -05:00
evazion
76c90cc0e4 Remove unused Pool methods: create_anonymous/options/id_to_name (#3206)
* Pool.id_to_name: never used.
* Pool.create_anonymous: never used.
* Pool.options: unused since e7aff87.
2017-07-09 14:32:17 -05:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
evazion
31b58e17b1 pools: lock pool when adding/removing posts (fixes #3091).
Adding a post id to a pool's post_ids string is non-atomic, hence we
must lock the pool to avoid a race condition.

Adding a pool to a post's pool_string is likewise non-atomic, hence we
must lock the post as well.
2017-05-26 18:35:33 -05:00
evazion
02b3622f12 api: allow search[*_id] params to accept lists of ids in more places. 2017-05-23 15:45:40 -05:00
r888888888
48e9856f37 fixes #3007: Eliminate Janitor role 2017-05-01 14:38:30 -07:00
r888888888
621bef3ddf Revert "Merge pull request #2952 from evazion/fix-2950"
This reverts commit ae4509a541197684bfb0538f65afa827854b4335, reversing
changes made to eb008a0e765e231a8fdef594759a61798d6bd1d5.
2017-04-14 12:28:58 -07:00
evazion
bb2f0ff795 /pools: make autocomplete use index.
`name ilike ?` doesn't use the index. Use `lower(name) like ?` instead.
2017-04-07 18:25:21 -05:00
evazion
8fff3315f2 fix #2950: don't send versions to archives if save fails. 2017-04-03 15:03:58 -07:00
Albert Yi
4d698bf98b add modaction helper 2017-01-03 15:04:47 -08:00
Albert Yi
ee4ebce4d7 support pool version archive 2016-12-21 11:43:46 -08: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
evazion
c46b31aa9c Prevent reverting to foreign versions (fixes #2711). 2016-10-11 06:57:46 +00:00
Toks
40800988a8 Fix new users being able to remove posts from pools 2015-10-22 22:25:02 -04:00
r888888888
6480864718 fixes #2469 2015-10-15 15:24:24 -07: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
b7a001c6d4 #2239 disallow pools literally named series/collection 2015-05-02 12:09:11 -04:00
Toks
5a8674d342 fix #2239 2015-05-02 11:12:30 -04:00
r888888888
267df896c6 fixes #2245 2014-08-25 16:41:27 -07:00
Toks
ab500084e6 fixes #1936 2014-07-12 18:44:09 -04:00
Toks
c48f03a926 Add pool search option by ids 2014-06-14 14:19:03 -04:00
Toks
8d8ad70c3f fixes #2144 2014-05-01 14:51:57 -04:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
r888888888
3e01e7abe1 fixes #2010 2014-03-19 15:07:44 -07:00
Toks
8772ac60d8 fix error 2013-12-11 14:13:55 -05:00
Toks
f9ede26fbc Fix expunged posts giving 404 errors on pool show pages 2013-12-10 21:25:46 -05:00
Toks
81aa294b38 add Note#for_creator, Pool#name_matches 2013-12-07 22:05:42 -05:00
Toks
d4f2ec7bc9 Make Pool#posts return an array instead of arel
fixes #2042
2013-12-03 23:03:50 -05:00
r888888888
b618322ac1 Fixes #2042, fix specs 2013-12-03 17:20:03 -08:00
Toks
2bc5605edc Allow searching for deleted pools 2013-11-01 10:07:47 -04:00
Toks
d0e9d4519a fixes #2016 2013-10-26 14:02:52 -04:00
r888888888
463c6fefdf fixes #2001 2013-10-08 13:56:02 -07:00
r888888888
989a04be97 fixes #1984 2013-09-26 17:25:01 -07:00
Toks
b32783c8ba fixes #1946 2013-08-18 18:24:39 -04:00
r888888888
cad82aa762 fixes #1864 2013-07-18 16:23:04 -07:00
Toks
46aad0d3f1 fixes #1576
The "params[:order] ||= params.delete(:sort)" is to support existing
links using sort.
2013-07-12 13:18:19 -04:00
Toks
a30a104f47 fixes #1467 2013-07-12 12:18:54 -04:00