Commit Graph

39 Commits

Author SHA1 Message Date
Donovan Daniels
6f296e8e01
[Posts] Add back comment disabling (#749) 2024-10-28 13:56:22 -07:00
Earlopain
fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00
Earlopain
918a3f491d
[Tests] Remove useless travel_to 2022-11-26 13:52:37 +01:00
Earlopain
b6fb6d3ee6
[Tests] Remove as_user helper 2022-11-26 12:49:35 +01:00
Earlopain
87313c437c [Tests] Include FactoryBot::Syntax::Methods
The newly included create method behaves exacly like the self-written one,
with the added benefit of it not appearing in backtraces.
2022-11-25 21:06:54 +01:00
Earlopain
c6dae231f0
[Tests] Remove remaining sqs stubs 2022-02-10 17:55:48 +01:00
Earlopain
a135c2a592
[Cleanup] Remove reportbooru 2022-02-09 15:39:07 +01:00
Kira
784890ca3e [Posts] Fix tag set presenter using broken memoist gem 2021-02-25 12:08:09 -08:00
evazion
971307ea44 tests: move authentication tests out of post tests. 2019-08-28 20:56:44 -07:00
evazion
9fbf208e44 posts: fix error on /posts?md5=<does_not_exist>. 2019-08-15 04:26:23 -07:00
Kira
f4f030f726 Password migration/upgrade
NOTE: All existing passwords in development no longer work after
this change! Change your users password using the rails console.

Automatically convert and ugrade old passwords to using bcrypt
Removed the seemingly pointless transformation and hashing on top
of the actual password with a static salt.
Disabled logging in using password hashes, because that's just not
secure in any way, and negates cracking passwords at all.
Disabled sending the password hash to the client as a cookie, even
if it was signed.
Disabled legacy API logins.
2019-02-21 21:10:20 -08:00
evazion
6fe883c316 posts index: clean up limit:<n> / order:random parsing (#2894)
* Move the limit:<n> / order:random metatag parsing from the controller
  to the post set.

* Introduce `Tag.has_metatag?` and use it to parse these metatags
  instead of using a regex (#2894).
2018-09-20 19:23:47 -05:00
r888888888
344c46ed00 add mock recommender service for development, add user-context recommended posts 2018-07-21 14:02:57 -07:00
Albert Yi
75162d3d8b bug fixes + tests 2018-07-20 12:31:28 -07:00
Albert Yi
6c14d19010 fix tests 2018-06-05 16:08:45 -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
c0e5c400a7 tests: fix tests for Rails.cache. 2017-04-16 16:48:36 -05:00
Albert Yi
5404c1d231 implement postarchive 2017-02-21 13:40:52 -08:00
evazion
dfb8d0106d tests: add more posts controller tests. 2017-02-06 18:48:37 -06:00
evazion
3ee7f0770f Fix posts controller api test.
1) Failure:
    PostsControllerTest#test_: The posts controller for api calls passing the api limit should work. [/home/danbooru/src/danbooru/test/functional/posts_controller_test.rb:34]:
    Expected response to be a <429>, but was <200>.
    Expected: 429
      Actual: 200
2017-02-03 04:03:43 -06:00
Albert Yi
f2a5d45db0 implement token bucket rate limiting 2017-01-09 17:31:14 -08:00
Albert Yi
2424f24fcd return 429 for too many requests instead of 421 2016-10-18 13:33:04 -07:00
evazion
80895ef46e Add tests for reverting to foreign versions. 2016-10-11 06:57:05 +00:00
evazion
ab5fd48280 Prevent mass assignment to Post#last_noted_at (#2704). 2016-10-06 09:39:57 +00:00
r888888888
46b32448e8 fix tests 2016-01-18 17:22:27 -08:00
r888888888
1d9596d7f2 fixes #2417 2015-06-29 18:17:59 -07:00
r888888888
6772566665 fixes #2166 2014-07-23 15:15:47 -07:00
r888888888
e6fb0c3caf fix post functional test 2013-07-25 14:37:15 -07:00
r888888888
6de808bd3b fix forum post views 2013-06-20 16:10:37 -07:00
albert
5a0b0dfa68 fix tests 2013-04-05 17:43:01 -04:00
albert
2ac22d07cd implement api limiting 2013-03-20 16:35:35 -07:00
albert
7470d189c3 add api authentication 2013-03-20 15:43:17 -07:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
17881068e1 * Removed Pixa/Tinami sources
* Upgraded to Rails 3.2.3
* Fixed tests
2012-06-01 19:22:58 -04:00
albert
69044f3389 reverted post version tag change for danbooru2 2011-10-22 21:34:32 -04:00
albert
c80df378d8 fixed tests 2011-02-02 16:55:36 -05:00
albert
3ba52acfe0 added post controller test 2011-01-28 18:03:00 -05:00
albert
2053e6ad8c * Renamed Post.find_by_tags into Post.tag_match, made into a full fledged scope
* Post.tag_match no longer takes an options hash (use other arel builders instead)
2011-01-28 17:40:22 -05:00
albert
683d4583ac * Added note version controller and test
* Added pool version controller and test
* Refactored unit tests for post disapprovals
* Renamed PostModerationDetail to PostDisapproval
2011-01-25 18:13:05 -05:00