Commit graph

56 commits

Author SHA1 Message Date
Andy Allan
6c1d73a509 Allow users to delete their own accounts
This PR allows users to delete their own accounts. The logic implemented matches
that currently used by the admins when they manually close accounts, although
there is room to be more complex in future e.g. completely removing accounts
with no content.

The error handling has been slightly adapted for namespaced controllers, by
anchoring the controller name with a leading forward slash.
2022-02-09 16:15:24 +00:00
Andy Allan
2731e7244a Add extra user transitions needed by the administrators 2022-02-02 16:37:50 +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
2f6a87e443 Use assert_link instead of assert page.has_link?
This leads to better error messages if the test fails
2022-01-06 15:04:03 +00:00
Andy Allan
d257c21740 Use assert_content instead of assert page.has_content?
The assert_content comes from capybara, and gives a much more helpful
error message if the test fails.
2022-01-06 13:16:47 +00:00
Andy Allan
4bed9c12a0 Fix display of suspension message when a user is suspended mid-session
Without the ability defined, the user is still logged out, but then
the deny_access check redirects to the login page. The re-login attempt
would then fail anyway, with an error message, but let's fix the abilities
and use the intended page.
2022-01-05 18:21:42 +00:00
Andy Allan
710bf75411 Rename file so that it's included in test runs 2021-09-16 18:04:37 +01:00
Andy Allan
95d406937e
Merge pull request #3268 from tomhughes/capitalisation
Improve capitalisation of page titles
2021-07-28 11:06:47 +01:00
Andy Allan
baee0b9a90 Enable test for showing flash message in the new language 2021-07-28 09:38:24 +01:00
Tom Hughes
abd98757b6 Improve capitalisation of page titles 2021-07-22 19:00:08 +01:00
Tom Hughes
f1935b1c57 Merge remote-tracking branch 'upstream/pull/3257' 2021-07-21 19:24:31 +01:00
Andy Allan
403c8941a6 Ensure that flash message is shown in the updated language 2021-07-21 18:58:47 +01:00
Josh Soref
7c7a6b13cc spelling: nonexistent
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-07-21 10:45:38 -04:00
Andy Allan
40589960be Use paragraphs instead of line breaks, and avoid using html in translation strings 2021-06-23 20:11:19 +01:00
Andy Allan
24f6aeda6a Use hash-based flash objects to render complex flash messages
Since flash objects can only be String, Hash or Array (notably excluding SafeBuffers), then this approach is necessary to render complex html in a safe manner.

Each local can be treated as an (unsafe) string, and therefore escaped normally when rendered into the template. The template (and translation strings) can
contain html since they are no longer stored in the flash as a plain string.

Fixes #3215
2021-06-23 20:10:55 +01:00
Andy Allan
60444d3015 Add test case to ensure clicking on the registration link takes you to the right page 2021-03-29 15:51:07 +01:00
Andy Allan
f18baae22e Refactor login/logout into sessions controller
Certain controller methods are shared with oauth-based logins, and these have been
moved to a concern.
2021-03-24 11:32:46 +00:00
Frederik Ramm
d14083129c Fix a small typo and tests that depend on it. 2021-01-19 20:56:43 +01:00
Tom Hughes
ea59d95f4a Fix some new rubocop warnings 2020-08-06 22:27:30 +01:00
Andy Allan
3bc2b32111 Rephrase 'replying' text to clarify what will actually happen
Fixes #2166
2020-07-15 15:13:29 +02:00
Tom Hughes
06122fc090 Enforce restrictions on issue visibility properly 2020-03-01 19:20:18 +00:00
Andy Allan
9643e3393d Update tests to ensure referer is working
This reinstates the form tests in the controller test, but uses
the system tests to actually click the button and make sure that
it works
2020-01-08 18:26:57 +01:00
Andy Allan
8a774e7519 Use a post link to logout
This avoids needing to access the session id, which is currently
only working with the memcache store.

The fallback page is preserved for anyone who wants to logout without
using javascript.

Refs #2488
2020-01-08 14:03:05 +01:00
Andy Allan
085412f624 Use i18n for submit button for issue comments
Normally when an en-GB.yml translation is missing, rails falls back to en.yml. But when
using the submit helpers, if the en-GB translation is missing, rails knows how to create
a fallback like 'Create {model_name}' without touching the en.yml file. This string might
then be different from what the test expects, e.g. 'Add Comment'.

So it's important to set the language headers, to avoid phantomjs from picking up your desktop
preferences in this specific case.
2019-06-12 19:24:06 +02:00
Andy Allan
9e158a5d39 Show all diary comments to administrators 2019-06-06 16:03:42 +02:00
Andy Allan
49fc17c6b6 Show deleted diary entries to administrators, if the user isn't also deleted
This will allow administrators to review diary entry deletions from non-spam users.
2019-06-06 15:59:47 +02:00
Andy Allan
fbcd2bc10a Refactor some diary entry routes to use resources 2019-05-29 15:55:27 +02:00
Andy Allan
234afb3f42 Remove custom deny_access handlers
Since these pages are not accessed by normal users, except for url fiddling, it's fine to respond with a generic access denied.
2018-11-14 14:10:51 +01:00
Andy Allan
26777c4464 Pluralize diary entries controller 2018-11-07 16:31:04 +01:00
Andy Allan
3ec67ea2d3 Rename user_controller to users_controller 2018-10-03 15:31:10 +02:00
Andy Allan
4dd4831c0a Just pass the user object, rather than the display_name, to the user_path helper 2018-09-10 10:54:29 +08:00
Andy Allan
19c26e70a3 Rename user#view to user#show 2018-09-05 14:21:01 +08:00
Tom Hughes
e5604ce98e Assign vandalism reports for users to moderators 2018-06-17 11:14:19 +01:00
Tom Hughes
0071025400 Avoid using "other" as a translation key 2018-06-16 16:21:07 +01:00
Tom Hughes
29f12c4547 Improve system tests for issues 2018-06-10 19:03:47 +01:00
Tom Hughes
d3700e6201 Merge branch 'master' into next 2018-06-10 17:02:12 +01:00
Tom Hughes
2aca6920dc Use lazy lookups for translations in issues 2018-06-10 16:59:58 +01:00
Andy Allan
45e6ebcafc Alter class to avoid conflict with model test class 2018-04-11 16:05:13 +08:00
Andy Allan
0a86a1ea8d Fix handling of title when replying to diary entries 2018-04-11 14:03:17 +08:00
Andy Allan
46c183ffeb Add more tests 2018-03-28 11:05:47 +08:00
Andy Allan
ab3150646c Update system tests for report link changes 2018-03-28 11:05:46 +08:00
Andy Allan
2fc70be734 Add a redirect and error message if user ends up trying to report something without the correct parameters 2018-03-14 17:09:57 +08:00
Andy Allan
e7e12a38c6 Create a more accurate permissions check message 2018-03-14 16:29:47 +08:00
Andy Allan
36970bcf50 Use underscore versions of model names for translation keys. 2018-03-14 12:12:24 +08:00
Andy Allan
1c04af415e Update tests for new link text 2018-02-28 16:10:30 +08:00
Andy Allan
80a241f798 Allow reporting of anonymous notes 2018-02-28 14:26:40 +08:00
Andy Allan
2d915b0e24 Avoid submit_tag to avoid 'Save changes' default 2018-02-23 12:30:37 +08:00
Andy Allan
79bd1777ab Fully internationalise the issues and reports interfaces. 2018-01-22 11:57:08 +00:00
Andy Allan
3a386f185c Reopen issues if necessary when creating a report. 2018-01-21 11:18:24 +00:00
Andy Allan
63992d83bd Store the report category. 2017-12-13 16:02:55 +00:00