0
0
Commit Graph

17 Commits

Author SHA1 Message Date
Claire
e38fc319dc
Refactor and improve tests ()
* Change account and user fabricators to simplify and improve tests

- `Fabricate(:account)` implicitly fabricates an associated `user` if
  no `domain` attribute is given (an account with `domain: nil` is
  considered a local account, but no user record was created), unless
  `user: nil` is passed
- `Fabricate(:account, user: Fabricate(:user))` should still be possible
  but is discouraged.

* Fix and refactor tests

- avoid passing unneeded attributes to `Fabricate(:user)` or
  `Fabricate(:account)`
- avoid embedding `Fabricate(:user)` into a `Fabricate(:account)` or the other
  way around
- prefer `Fabricate(:user, account_attributes: …)` to
  `Fabricate(:user, account: Fabricate(:account, …)`
- also, some tests were using remote accounts with local user records, which is
  not representative of production code.
2022-01-28 00:46:42 +01:00
Claire
cbd0ee1d07
Update Mastodon to Rails 6.1 ()
* Update devise-two-factor to unreleased fork for Rails 6 support

Update tests to match new `rotp` version.

* Update nsa gem to unreleased fork for Rails 6 support

* Update rails to 6.1.3 and rails-i18n to 6.0

* Update to unreleased fork of pluck_each for Ruby 6 support

* Run "rails app:update"

* Add missing ActiveStorage config file

* Use config.ssl_options instead of removed ApplicationController#force_ssl

Disabled force_ssl-related tests as they do not seem to be easily testable
anymore.

* Fix nonce directives by removing Rails 5 specific monkey-patching

* Fix fixture_file_upload deprecation warning

* Fix yield-based test failing with Rails 6

* Use Rails 6's index_with when possible

* Use ActiveRecord::Cache::Store#delete_multi from Rails 6

This will yield better performances when deleting an account

* Disable Rails 6.1's automatic preload link headers

Since Rails 6.1, ActionView adds preload links for javascript files
in the Links header per default.

In our case, that will bloat headers too much and potentially cause
issues with reverse proxies. Furhermore, we don't need those links,
as we already output them as HTML link tags.

* Switch to Rails 6.0 default config

* Switch to Rails 6.1 default config

* Do not include autoload paths in the load path
2021-03-24 10:44:31 +01:00
abcang
7ab53f221a
Improved performance of notification preloading ()
* Improved performance of notification preloading

* Remove Cacheable from Notification

* Fix test
2021-01-31 21:24:57 +01:00
Yamagishi Kazutoshi
afb398b583 Change to always returns html document in error pages () 2019-11-13 22:53:05 +01:00
Tao Bror Bojlén
4fe127664b add admin setting for default search engine indexing (fix ) () 2019-09-11 08:44:58 +02:00
Eugen Rochko
964ae8eee5
Change unconfirmed user login behaviour ()
Allow access to account settings, 2FA, authorized applications, and
account deletions to unconfirmed and pending users, as well as
users who had their accounts disabled. Suspended users cannot update
their e-mail or password or delete their account.

Display account status on account settings page, for example, when
an account is frozen, limited, unconfirmed or pending review.

After sign up, login users straight away and show a simple page that
tells them the status of their account with links to account settings
and logout, to reduce onboarding friction and allow users to correct
wrongly typed e-mail addresses.

Move the final sign-up step of SSO integrations to be the same
as above to reduce code duplication.
2019-07-22 10:48:50 +02:00
Eugen Rochko
b851456139
Remove Atom feeds and old URLs in the form of GET /:username/updates/:id () 2019-07-07 16:16:51 +02:00
aus-social
1f98eae1cf Lint pass () 2018-10-04 12:36:53 +02:00
Jakub Mendyk
6cb3514d64 Add ability to change an instance default theme from the administration panel () ()
* Add default_settings class method to ScopedSettings

ScopedSettings was extended to use value of unscoped setting instead of
only using defaults set in config/settings.yml for selected settings.
This adds possibility for admins to set default values of users' settings,
for example default theme (as requested in ).

* Add ability to change an instance default theme

Closes 
2018-08-23 14:17:35 +02:00
Yamagishi Kazutoshi
d10447c3a8 Use raw status code on have_http_status () 2018-04-21 21:35:07 +02:00
Emelia Smith
2e59751823 Improve require_admin! and require_staff! filters ()
Previously these returns 302 redirects instead of 403s, which meant posting links to admin pages in slack caused them to unfurl, rather than stay as a link. Additionally, require_admin! doesn't appear to be actively used, on require_staff!
2018-04-03 13:07:32 +02:00
Yamagishi Kazutoshi
1d92b90be9 Fix force_ssl conditional () 2018-01-07 15:19:23 +01:00
unarist
0f1b1d78b1 Use "match_array" only for order independent assertions () 2017-06-07 12:59:28 -04:00
Akihiko Odaki (@fn_aki@pawoo.net)
10768aa204 Spec response for forgery ()
Remove protect_from_forgery in ApiController, which is disabled by the
following skip_before_action, as well.
2017-06-01 20:56:55 +02:00
Yamagishi Kazutoshi
41fa53253c Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail) ()
* Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail)

* use climate_control
2017-05-31 17:09:17 +02:00
Akihiko Odaki
bda7391221 Cover ApplicationController more in spec () 2017-05-22 17:58:57 +02:00
Akihiko Odaki
aa662cecad single_user_mode? always returns boolean ()
This change also adds a specification for the method.
2017-05-22 06:00:06 +02:00