Commit Graph

305 Commits

Author SHA1 Message Date
Albert Yi
72f319ccf3 rename lambda references to use shorthand syntax 2018-05-10 11:18:02 -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
evazion
96669ca4b5 Fix #3694: Favgroup UX issues. 2018-05-03 00:53:42 -05:00
evazion
a6499b5169 post tooltips: add disable option (#3689).
* Add "disable post tooltips" account setting.
* Add back title attribute for when fancy tooltips are disabled.
2018-04-28 23:50:51 -05:00
Albert Yi
b0a3f574ed fixes #3574 2018-04-25 14:31:11 -07:00
evazion
909c9aad5a Fix user id cache expiration.
Use a delayed job instead of a HTTP request to invalidate the user id
cache on both servers.
2018-04-19 00:45:51 -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
r888888888
604e9e9866 fix some unit tests 2018-01-02 15:12:48 -08:00
r888888888
4a80d6c337 refactor User#validate_sock_puppet to disable for tests 2018-01-02 14:32:38 -08:00
evazion
3e936748c0 Fix #3468: Approval queue should not show one's own uploads or previous approvals. 2017-12-28 19:36:37 -06: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
e2eb45a5a3 Auto-promote DanbooruBot to Mod. Auto-create DanbooruBot if it doesn't exist. 2017-12-15 18:54:18 -06:00
r888888888
a95af95eae move desktop mode to user pref 2017-12-15 13:52:25 -08:00
evazion
df7648b581 Fix #3392: Add safe mode account setting. 2017-11-20 18:59:53 -06:00
r888888888
e70c2a3085 remove references to tag subscriptions 2017-11-17 13:45:17 -08:00
BrokenEagle
5b4ab8d80e Disallow a user from seeing flagger's name on own uploads 2017-11-08 00:37:16 -08:00
r888888888
32ff7de6d8 fixes #3346 2017-10-30 14:47:00 -07:00
r888888888
4c565b443e add 24 hour window for repeating an ip addr for account creation (ref #3301) 2017-09-15 15:13:01 -07:00
r888888888
908770c4b0 fixes #3305 2017-09-15 14:50:23 -07:00
evazion
5a6cc84817 favorites: don't regen fav count when adding favorites.
Don't randomly regen the fav count when favoriting a post. This was a
workaround for #1210 that is no longer needed.
2017-09-13 13:29:35 -07:00
r888888888
95854756b4 fixes #3294 2017-09-13 13:17:16 -07:00
r888888888
d4ffe13b3f fixes #3296 2017-09-12 15:18:41 -07:00
r888888888
68863ed018 fixes #3287 2017-09-08 15:01:12 -07:00
r888888888
63f7edd0c6 add toggle for testing cropped thumbnails 2017-09-06 17:02:43 -07:00
r888888888
840cdc817d fixes #3271 2017-08-24 15:45:19 -07:00
r888888888
18f617e08a potential fix for #3189 2017-08-24 15:39:06 -07:00
evazion
6797f8564d upload limits: show full upload limits on upload page. 2017-08-10 23:58:58 -05:00
evazion
1ef363dd68 upload limits: add time remaining until next upload to profiles (fix #3262). 2017-08-10 23:58:58 -05:00
evazion
bf3101da48 upload limits: show how upload limits are calculated in profiles.
* Allow mousing over the upload limit on profile pages to show the full
  formula for the upload limit calculation. In particular, show how the
  upload limit multiplier is derived from the deletion confidence.

* Refactor to avoid duplicating upload limit calculations in the
  presenter, as much as possible.
2017-08-10 23:48:50 -05:00
r888888888
d48ed95191 favoritescontroller#destroy should work even if the post doesn't exist, remove from favorites on expunge (fixes #3222) 2017-07-19 13:39:24 -07:00
r888888888
97ce9cafac add httparty option config 2017-07-12 15:52:48 -07:00
r888888888
eb6c5e3af5 switch to httparty 2017-07-12 15:52:48 -07:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
evazion
1ffc9d286c Fix User#can_view_flagger?. 2017-06-14 12:08:25 -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
evazion
23fb6b8d15 /users/$id.json: fix exception when pool archives is disabled (fix #3123). 2017-06-07 22:54:16 -05:00
Albert Yi
92c4c043f0 Merge pull request #3032 from evazion/fix-expired-bans
Fix exception when user with expired ban logs in.
2017-05-08 11:33:44 -07:00
evazion
fd291c8b42 bans: fix exception when user with expired ban logs in.
`ban.destroy` fails because users have many `bans`, not a single `ban`.
Destroying the expired ban isn't necessary anyway.
2017-05-07 12:13:19 -05:00
evazion
43ad3258e5 API: fix api limits being lowered when user doesn't have api key. 2017-05-04 12:57:20 -05:00
r888888888
48e9856f37 fixes #3007: Eliminate Janitor role 2017-05-01 14:38:30 -07:00
evazion
e10327219d /users/1234.json: include upload_limit/max_upload_limit/favorite_group_count. 2017-04-29 12:26:25 -05:00
evazion
f7509433b1 /users.json: make private attributes visible to the user themselves (fix #1551). 2017-04-29 12:26:24 -05:00
evazion
258fc37bfe Post#approve!: move validation to post_approval.rb 2017-04-03 17:18:31 -05:00
evazion
fd24ea5876 posts.rb: vote on behalf of correct user when moving favorites.
Bug: when an approver moves the favorites of a post, each favorite is
removed from the child post and added to the parent post. For gold+
users, this triggers an upvote, but these upvotes were performed by the
approver rather than the favoriter.
2017-03-24 15:43:28 -05:00
r888888888
da06bee0ab revamp saved search implementation 2017-03-15 15:36:48 -07:00
r888888888
97cc8b5931 ignore privacy mode settings for admins 2017-03-09 13:52:46 -08:00
r888888888
e94edc9a75 switch approver and post pruners to use system user 2017-02-28 17:10:36 -08:00
evazion
6966b74e18 Disallow unicode whitespace in usernames (#2894). 2017-02-25 01:51:33 -06:00