Commit Graph

51 Commits

Author SHA1 Message Date
Albert Yi
72f319ccf3 rename lambda references to use shorthand syntax 2018-05-10 11:18:02 -07:00
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
c7492343ce String: add truthy? & falsy? core extensions.
* Add `truthy?` and `falsy?` core extensions to String.

* Use `truthy?` and `falsy?` to replace ad-hoc parsing of boolean
  parameters in various places.
2018-05-03 19:57:14 -05:00
Albert Yi
f2b525a6d2 Implement forum topic voting and tag change pruning (#3580) 2018-04-26 15:31:06 -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
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
f07aa1b170 bulk update requests: convert to strong params. 2018-02-18 12:12:12 -06: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
evazion
3df404dbd9 Fix #3380: Change category on Bulk Update Requests are broken. 2017-11-17 12:19:39 -06:00
evazion
f2351766c6 Fix #3374: List approver in BUR approval messages. 2017-11-15 19:12:12 -06:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
evazion
614bf44086 /bulk_update_requests: add search form. 2017-05-23 17:23:32 -05:00
r888888888
144febc104 remove timestamps 2017-04-14 12:49:41 -07:00
r888888888
db4fa8c7da support dynamic updates of forum for bulk update requests 2017-04-12 17:09:09 -07:00
r888888888
19b8d41d09 refactor forum notifications for tag changes 2017-04-12 16:43:15 -07:00
Albert Yi
dfb7a000a5 assign approver on failed bulk update requests to fix nil error 2016-12-08 11:49:38 -08: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
r888888888
388b2ed6e2 potential fix for #2609 2016-06-15 12:42:31 -07:00
r888888888
4fea400b79 fixes #2610: Strip image metadata when creating thumbnails and samples 2016-06-15 11:38:35 -07:00
r888888888
505f3f7c03 fixes #2609: BUR is impossible to approve 2016-06-15 11:17:19 -07:00
Type-kun
ef695f1ec1 Prettify BUR details link a little (#2599)
Also add the link when BUR fails.
2016-06-15 13:03:39 +05:00
r888888888
df9b53715f fixes #2599: Show more info when a BUR is approved/rejected 2016-06-14 10:45:15 -07:00
r888888888
4c91638f7a fixes #2599: Show more info when a BUR is approved/rejected 2016-06-09 14:12:55 -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
d75546a4e4 add secondary validations to aliases+implications+requests 2016-02-11 11:48:56 -08:00
r888888888
e6b16e8fe5 better validation for bulk update requests 2016-01-28 17:59:45 -08:00
Toks
b22670a2be Support searching list of ids for artists, aliases, implications, BURs
fix #2455
2015-07-25 00:13:29 -04:00
r888888888
7618576e7b update forum topic on bulk update request approve failure 2015-07-07 14:11:26 -07:00
Toks
d33fd43d9d Keep track of who rejects alias/impl/bur
Since anyone builder+ can now reject these I don't think it should
always be attributed to albert.
2015-07-02 11:37:22 -04:00
r888888888
1d9596d7f2 fixes #2417 2015-06-29 18:17:59 -07: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
Toks
3565d3dd08 Don't say bulk request was approved if it errored out during approval 2015-04-05 18:58:01 -04:00
r888888888
387dece55a update forum topic when alias/implication/update request is updated 2015-02-15 12:51:02 -08:00
Toks
c38a290f4c Only require BUR title if creating new topic 2014-12-18 11:02:22 -05:00
Toks
13101e7c88 #2250 fix validations not allowing empty topic id 2014-08-23 20:01:56 -04:00
Toks
c5cabe4e58 fix for #2250 2014-08-23 19:41:44 -04:00
Toks
d79cec75d0 fixes #2208 2014-07-01 17:57:58 -04:00
r888888888
04784dc5d9 fixes #2208 2014-07-01 14:34:50 -07:00
Toks
08d03263dd fix error 2014-06-19 03:06:36 -04:00
r888888888
4ab6a2417f fixes #2199 2014-06-17 18:07:19 -07:00
Toks
dfb47199a0 bulk reqs: change topic formatting to match alias/implication reqs 2014-06-17 13:43:29 -04:00
Toks
2ff5b1dfbc bulk reqs: link to wiki pages/tag search 2014-06-17 13:36:33 -04:00
Toks
0674fdca15 fix dead "link to request" link 2014-06-17 13:20:29 -04:00
Toks
3103b97c8b fixes #2198 2014-06-17 13:19:40 -04:00
Toks
016ea330d0 bulk reqs: require script & title 2014-06-17 13:10:13 -04:00
r888888888
87ef2b8e0f fixes #2190 2014-06-16 17:29:35 -07:00