Commit graph

226 commits

Author SHA1 Message Date
Gregory Igelmund
d0ec5d1437 Add tests & factories for UserMute feature 2023-12-19 12:57:47 -05:00
Tom Hughes
d8e5b84e5b Add test for no_trace_download ACLs 2023-12-19 12:03:08 +00:00
Tom Hughes
f28bad7229 Add test for no_note_comment ACLs 2023-12-19 12:03:08 +00:00
Tom Hughes
9a6a6fab73 Make allow_account_creation work the same as other ACLs 2023-12-19 12:03:08 +00:00
Milan Cvetkovic
a4c23cd89f Implement allow list for account creation 2023-12-17 07:55:43 +00:00
Anton Khorev
a8aaf62e62 Add earliest allowed deletion time to user model 2023-11-22 17:02:48 +03:00
Andy Allan
1700c23dd1 Prefer find_by() instead of where().first
These are very similar, differing only if we would expect multiple
results and the sorting is important. However, in all our cases
we're only expecting one result to be returned, and so find_by is
easier to read.
2023-10-04 17:53:58 +01:00
Andy Allan
b595b87c48 Use trace instead of gpx_id in queries
This makes the queries easier to read.
2023-08-30 17:08:46 +01: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
Andy Allan
415ac577f3 Remove some old debugging comments 2022-12-21 12:05:15 +00:00
Tom Hughes
9cd96bd452 Fix new rubocop warnings 2022-09-09 22:45:58 +01:00
Anton Khorev
b54c03389b Strip leading/trailing whitespace from comma-separated trace tags 2022-07-19 13:47:28 +03:00
Tom Hughes
a3a228862c Add validation for relation member roles
Fixes #3563
2022-06-09 19:21:08 +01:00
Harry Wood
3ca8b63643 Put issue comments through kramdown formatter
On issue comments (which only admins can create or see), put the `body` text through kramdown formatting.
2022-05-06 13:36:59 +01:00
Harry Wood
e204e1d178 Add some basic testing of issue_comment model
A factory and a basic test of validation for the issue_comment model, similar to what we have for diary_comment.
2022-05-06 12:38:17 +01:00
Harry Wood
9401e451d1 Format report text with kramdown
Pass the text of reports ('details' field) through the RichText formatter to give us kramdown formatting support.
2022-04-29 01:31:39 +01:00
Andy Allan
5c2cb9e96f Use factories for tag uniqueness tests 2022-03-30 17:15:11 +01:00
Andy Allan
034db6820f Simplify changeset tag tests by using factories
This saves lots of boilerplate in creating a valid test object
2022-03-30 17:03:04 +01:00
Andy Allan
374518f58a Rework 'empty' tag tests
These tests were checking that the parent object was set, but this
was not obvious from the way that the tests were named and constructed.

This refactoring makes it clearer what is being checked.
2022-03-30 16:37:16 +01:00
Tom Hughes
03cad948e3 Fix new rubocop warnings 2022-03-15 19:24:09 +00:00
Andy Allan
d6f8302eae
Merge pull request #3491 from tomhughes/legacy-trace
Remove support for legacy trace files
2022-03-09 17:10:40 +00:00
Tom Hughes
cbcc7dc49f Fix some rubocop Naming/PredicateName warnings 2022-03-03 22:47:55 +00:00
Tom Hughes
92b122759f Remove support for legacy trace files 2022-03-03 19:47:40 +00:00
Tom Hughes
b5f06e06c1 Fix rubocop Rails/TimeZone warnings 2022-03-01 22:55:10 +00:00
Andy Allan
2fabc46421
Merge pull request #3440 from mmd-osm/relationmemberlimit
Introduce relation member limit
2022-02-16 14:58:30 +00:00
Tom Hughes
53aa7259bb Merge remote-tracking branch 'upstream/pull/3345' 2022-02-13 18:39:21 +00:00
mmd-osm
2efd73c672 Introduce relation member limit
Adds a new parameter `max_number_of_relation_members` in settings.yml
2022-02-02 13:15:40 +01: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
0100cfe304 Use factory_bot to build new model objects 2022-01-06 10:46:38 +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
Tom Hughes
0410596908 Switch traces to use ActiveStorage 2021-12-16 18:45:31 +00:00
Andy Allan
9ab15f38ea Move the tracepoint coordinate format test to the controller test
This allows us to remove the model method
2021-09-29 15:25:28 +01:00
Andy Allan
d07ce46929 Move the xml format test for old nodes to the controller test
This allows us to remove the model method
2021-09-15 17:05:34 +01:00
Josh Soref
590f94f531 spelling: uniqueness
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-07-21 10:45:38 -04: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
da546af22e Allow acls to match on parent domains 2021-07-06 10:13:33 +01:00
Andy Allan
408c883d24 Skip intermediate lengths when testing tag validity
It's really the upper and lower boundaries that we want to check,
and it's reasonable to assume all the intermediate values will work
fine if the boundary values are tested.

This also saves about 75% of the time taken and almost 85% of the
assertions when running all the model tests.
2021-06-16 09:53:57 +01:00
Tom Hughes
70d7d8d850 Fix some ruby 3 compatibility issues 2021-04-22 19:20:25 +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
Tom Hughes
88ba316abe Merge remote-tracking branch 'upstream/pull/2999' 2020-12-09 14:51:04 +00:00
Tom Hughes
582402ba8f Prefer keyword arguments when method has optional boolean arguments 2020-11-13 10:22:55 +00:00
Andy Allan
1f242978af Prefer keyword arguments when method has optional boolean arguments 2020-11-12 11:24:44 +00:00
Andy Allan
a65cb84288 Remove unused code 2020-11-11 16:43:58 +00:00
Tom Hughes
ea59d95f4a Fix some new rubocop warnings 2020-08-06 22:27:30 +01:00
Tom Hughes
2d3972249c Fix some rubocop todos 2020-08-02 19:38:58 +01:00
Tom Hughes
7a1615bc55 Fix rubocop-minitest warnings 2020-04-15 19:07:13 +01:00