Anton Khorev
a05de1e0a7
Use assert_not_predicate instead of assert_not next to assert_predicate
2024-07-25 04:56:57 +03:00
Tom Hughes
3360f91733
Require display names to have a minimum unicode width of 3 columns
...
Fixes #4538
2024-02-25 13:21:03 +00:00
Andy Allan
7406ae5dcc
Merge pull request #4218 from AntonKhorev/no-user-id-renames
...
Disallow username changes to user_n if n isn't their id
2024-01-18 10:47:17 +00:00
Andy Allan
0a21080192
Move change detection to validation declaration
...
This aligns with other validations. Also add test to ensure unchanged
display_names are treated as valid.
2024-01-18 10:33:56 +00:00
Anton Khorev
2c342adc0d
Disallow username changes to user_n if n isn't their id
2024-01-18 10:33:56 +00:00
Andy Allan
d5efa4c357
Merge pull request #4405 from tomhughes/normalize-display-name
...
Require user names to be unique after unicode normalisation
2024-01-17 16:24:09 +00:00
Anton Khorev
3a8a997fb8
Use assert_not_predicate in tests that have assert_predicate
2024-01-03 16:01:17 +03:00
Tom Hughes
c12f8959dd
Require user names to be unique after unicode normalisation
...
As with the previous checks on case sensitivity this only affects
new users, and changes to names of existing users.
2023-12-13 22:27:36 +00:00
Anton Khorev
a8aaf62e62
Add earliest allowed deletion time to user model
2023-11-22 17:02:48 +03:00
Tom Hughes
6982903ae7
Fix predicate method names in the user model
2023-08-15 18:53:14 +01:00
Tom Hughes
e5406c6836
Make test names clearer
2022-12-29 16:52:19 +00:00
Andy Allan
0925035a3e
Add tests to ensure tokens are revoked
...
This ensures that tokens are revoked or invalidated when a user
is soft destroyed.
2022-12-28 15:25:57 +00:00
Tom Hughes
03cad948e3
Fix new rubocop warnings
2022-03-15 19:24:09 +00:00
Tom Hughes
cbcc7dc49f
Fix some rubocop Naming/PredicateName warnings
2022-03-03 22:47:55 +00:00
Andy Allan
1a11c4dc19
Use a state machine for user status
...
The user status is a bit complex, since there are various states and
not all transitions between them make sense.
Using AASM means that we can name and restrict the transitions, which
hopefully makes them easier to reason about.
2022-01-12 18:16:14 +00:00
Andy Allan
88cf03ff00
Use factorybot to build user objects
...
This allows us to only specify attributes of interest in the test.
2022-01-05 20:29:12 +00:00
Andy Allan
a863be8831
Rename User#delete to User#destroy
...
"delete" is generally used for immediate SQL deletion without running
any callbacks or other ruby code, whereas "destroy" will trigger callbacks.
Although we don't currently use any callbacks, let's rename this method to
align better with the convention.
2021-12-22 11:32:33 +00:00
Andy Allan
37b03e47c6
Fix various code comments
...
These were found as part of #3233
2021-07-21 11:24:23 +01:00
Tom Hughes
3512d6303c
Fix new rubocop warnings
2021-03-23 19:48:13 +00:00
Tom Hughes
0ff89c31e4
Remove both Potlatch versions
...
Fixes #2622
2021-01-05 21:18:45 +00:00
Andy Allan
a65cb84288
Remove unused code
2020-11-11 16:43:58 +00:00
Tom Hughes
7a1615bc55
Fix rubocop-minitest warnings
2020-04-15 19:07:13 +01:00
Tom Hughes
91a37235ac
Remove support for old style user images
2019-07-16 22:33:26 +01:00
Andy Allan
2169c503ef
Rename user.friend_users to user.friends
...
This is possible now since we've renamed Friend to Friendship
2019-06-19 16:51:35 +02:00
Andy Allan
1cf8fec58d
Rename Friend model to Friendship
...
This better describes what the model represents, which is the relationship
between the two users.
2019-06-19 16:39:25 +02:00
J Guthrie
1e57189366
Added tests for validators
2018-11-05 16:23:30 +00:00
J Guthrie
6cde8c9b0c
Changed User model to not allow nil display_name (w/ tests)
2018-11-05 15:40:37 +00:00
Tom Hughes
f7a35c5895
Fix new rubocop warnings
2018-06-18 09:00:49 +01:00
Tom Hughes
cb3c4ec09b
Update for rubocop 0.54.0
2018-05-17 19:39:25 +01:00
Tom Hughes
b6b9d543ac
Fix rubocop warnings
2017-10-29 19:43:02 +00:00
Tom Hughes
5b33f3f8e3
Fix rubocop warnings
2017-06-02 00:08:30 +01:00
Andy Allan
5d0ea28796
Remove the api_fixtures helper
...
This is no longer required, as the tests no longer use fixtures.
2017-06-01 10:59:48 +01:00
Andy Allan
1041ead253
Convert the test_users_nearby to user factories.
2017-02-02 13:52:26 +00:00
Andy Allan
3b26ff0c40
Use factory for user language tests
2017-02-02 13:33:15 +00:00
Andy Allan
b83271de92
Refactor the friend_users test, and remove the tests which duplicate the (renamed) test_friends_with above.
2017-02-02 13:24:46 +00:00
Andy Allan
f96c563c10
Convert test_friend_with to use factories, and use alice/bob/charlie for easier understanding.
2017-02-02 13:20:51 +00:00
Andy Allan
584748fe0a
User factory for uniqueness tests
2017-02-02 13:09:39 +00:00
Andy Allan
df6469c76b
Convert class method tests to use User factory.
...
Also improve the tests by being explicit about which results should
be returned, rather than just hoping that the fixtures cover all
possibilities.
2017-02-02 13:05:43 +00:00
Andy Allan
0bd2e9ea8c
Add status traits to user factory.
2017-02-02 12:55:32 +00:00
Andy Allan
38fc6331af
Add moderator_user and administrator_user factories.
2017-02-02 12:38:19 +00:00
Andy Allan
9e591d8ccb
Add with_home_location trait for user factories.
2017-02-02 12:08:36 +00:00
Andy Allan
589e9802a9
Create a simple user factory, and convert some basic tests.
2017-02-01 17:42:05 +00:00
Tom Hughes
69b967c9ff
Add support for Wikimedia authentication
...
Closes #1146
2016-12-20 22:32:25 +00:00
Tom Hughes
b9b255fa65
Work around upcoming minitest insanity
...
Minitest 6 will not allow assert_equal to compare for equality
with nil and minitest 5 has already started warning about it.
That's fine if you're comparing with a nil constant, but if you're
comparing with an expression that is sometimes nil and sometimes
not nil it's an absolute pain in the rear end.
2016-12-02 22:29:44 +00:00
Andy Allan
c365e2b28a
Convert the languages fixtures to a factory
...
For some tests, the existance of an 'en' language is assumed by
the database structure (not null default 'en'::character varying) so
this can be created in a setup block.
2016-10-26 13:14:52 +01:00
Andy Allan
feb3b03227
Use model relations when creating objects from factories
...
Rather than passing around record ids explicitly, we can use the
model relations and pass around the models. This makes reading the
tests slightly simpler to read.
2016-10-19 11:32:08 +01:00
Andy Allan
bfe760a4b0
Replace friends fixture with a factory
2016-10-05 13:18:45 +01:00
Simon Poole
90b7101cc3
Add tests for change of gravatar use depending on email
2016-08-16 22:09:11 +02:00
Tom Hughes
c70a1fe933
Add support for GitHub authentication
2016-07-14 09:40:45 +01:00
Tom Hughes
4028f4cdb9
Rework locale selection
...
Implement our own matching algorithm rather than trying to
patch the http_accept_language one and make sure everything is
using it in a consistent way.
Fixes #1125
2016-01-06 18:43:25 +00:00