Commit Graph

89 Commits

Author SHA1 Message Date
Cinder
a0b51e40bc
[Users] Rework login pages and increase password requirements (#825) 2024-12-14 17:37:53 -08: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
4c6f4fe104
[CI] Appease rubocop 2023-09-07 17:32:50 +02:00
Earlopain
d5b64b1712
[Tests] Improve execution time of some of the worst offenders
From 112 seconds to 107 on my machine
Not much all things considered but most of the time is still spend on
elasticsearch, especially when forcefully recreating the index
2023-09-07 17:04:34 +02:00
Earlopain
3aecc36b3e
[Users] Fix exception when refreshing counts 2023-08-15 14:13:58 +02:00
Earlopain
3f03182dfb
[Cleanup] Remove a test-only method 2023-08-11 17:30:43 +02:00
Earlopain
40dd24f387
[Cleanup] Remove search_text_attribute
* Undocumented
* Some don't work because of strong params

Some of the possible attributes seem like they would be
useful but I would rather introduce them properly and
with more thought behind it
2023-06-01 21:45:51 +02:00
Earlopain
7a028cf003
[Tests] Set CurrentUser.ip_addr in base setup 2022-11-26 16:20:16 +01:00
Earlopain
c68fdfce2b
[Tests] Always use CurrentUser as helper 2022-11-26 15:20:15 +01:00
Earlopain
98e55562eb
[Tests] Clean up teardowns 2022-11-26 14:02:06 +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
6801742487
[Cleanup] Remove promote message code 2022-09-26 20:20:20 +02:00
Jason Gronn
23253d6766
[Comments] Disable downvoting own comment (#397)
* Disable downvoting own comment; hide vote buttons for own comment

* Revert hiding buttons; merge upvote/downvote paths; fix tests that relied on previous behaviour

* Undo some changes I did not mean to make

* Fix a mistake I made

* Fix some other unit tests
2022-04-30 12:48:53 +02:00
Earlopain
0d50202bbd
[Tests] Fix a bunch
1269 runs, 2237 assertions, 68 failures, 27 errors, 0 skips
2022-04-07 18:23:20 +02:00
Earlopain
061176e095
[Setup] Ignore limits when seeding
This makes the environment config understand booleans. If something
ends with "?" it tries to interpret it as a boolean. A bunch of
existing configs where changed to reflect this change.
2021-11-14 22:16:36 +01:00
Earlopain
8d8a0802a5
[User] Remove memoization of throttles
This interfered with tests and doesn't seem to give much of an advantage
2021-05-15 12:36:29 +02:00
Earlopain
9df05e7ba8
[Tests] Add test for forum post throttles 2021-05-14 17:54:46 +02:00
Earlopain
11f4b5e15b
[Tests] Fix user tests 2021-05-14 17:12:51 +02:00
Earlopain
015c238dca
[Config] Remove member_comment_time_threshold
This was only stubbed in tests and not used anywhere else
2021-05-14 17:07:43 +02:00
Kira
e685fb87c2 [Tests] Update tests and fix deprecations 2021-02-25 12:08:09 -08:00
Kira
55cb64acf7 Fix deprecated use of update_attributes 2019-09-09 12:58:18 -07:00
evazion
ef806bf340 tests: fix ip ban test regression. 2019-08-13 03:28:27 -07:00
Kira
9fa294ba31 Convert gold -> privileged for user level 2019-06-29 08:45:58 -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
Kira
143e428bab Add email blacklist to user model
Thi allows prevent specific email addresses from being used during
signup or email change.
2019-02-09 14:00:37 -08:00
evazion
f5012464ab Fix #3965: Extraneous API attributes.
Remove the updater_id/updater_ip_addr virtual attributes from
pools/notes. Juss pass them in as params to create_version instead.
2018-10-30 15:41:17 -05:00
evazion
3dafca9aec Fix #3842: Mods can demote other mods or admins. 2018-08-25 13:52:50 -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
dd8d80eaf7
Updated tests for mod actions 2018-01-14 00:07:20 -08:00
r888888888
604e9e9866 fix some unit tests 2018-01-02 15:12:48 -08: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
4c565b443e add 24 hour window for repeating an ip addr for account creation (ref #3301) 2017-09-15 15:13:01 -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
evazion
cebf29f83e Allow escaping wildcards (\*) in wildcard searches. 2017-05-31 16:15:18 -05:00
r888888888
48e9856f37 fixes #3007: Eliminate Janitor role 2017-05-01 14:38:30 -07:00
evazion
c0e5c400a7 tests: fix tests for Rails.cache. 2017-04-16 16:48:36 -05:00
Albert Yi
fd7cddc909 Merge branch 'master' into fix-mention-dmails 2017-02-27 17:00:24 -08:00
evazion
6e3ddb6ed6 dmails: don't save copies of outgoing dmails sent by DanbooruBot.
There's not much sense in saving copies of everything DanbooruBot sends
in DanbooruBot's inbox. They probably won't be checked so it just bloats
the dmails table.
2017-02-25 23:05:44 -06:00
evazion
6966b74e18 Disallow unicode whitespace in usernames (#2894). 2017-02-25 01:51:33 -06:00
evazion
6704e71377 dmails: add tests for automated dmails. 2017-02-23 22:51:17 -06:00
Albert Yi
5a1ac41450 eliminate transaction log items table 2016-12-21 15:00:59 -08:00
evazion
01afc46f74 Fix failures in commenting tests.
Restricting users from upvoting their own comments broke some tests.
Switch these tests to downvoting instead.
2016-12-03 20:06:50 -06:00
r888888888
ce3af81c9f fix tests 2016-01-18 17:13:26 -08:00
r888888888
6480864718 fixes #2469 2015-10-15 15:24:24 -07:00
r888888888
3df9f0cdf6 fix unit tests 2015-09-23 12:13:14 -07:00
Toks
055d0eecd3 Remove redundant promoter name from user feedback
Feedbacks already keep track of who created them so it doesn't need to
be in the body too
2014-04-30 21:18:18 -04:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
r888888888
37d75e4a88 Fixes #1266 2014-03-05 17:53:26 -08:00
r888888888
14dd0430cb fixes #1257 2014-03-05 17:33:57 -08:00
r888888888
a285089f7a potential fix for #1926 2014-02-13 11:30:35 -08:00