diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-17 10:58:25 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-02-17 10:58:44 +0100 |
commit | f224237862b009ad4b008a8730c58111f103145b (patch) | |
tree | 097c08663c6348914fdf95d2ac9ce57ee2a3307c /app/controllers/auth | |
parent | ec4f9066189fbab4368a275e9cd654dc7ad48217 (diff) | |
parent | ac99f586bb4138e083676579097d951434e90515 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `db/schema.rb`: Conflict due to glitch-soc adding the `content_type` column on status edits and thus having a different schema version number. Solved by taking upstream's schema version number, as it is higher than glitch-soc's.
Diffstat (limited to 'app/controllers/auth')
-rw-r--r-- | app/controllers/auth/registrations_controller.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb index 6b1f3fa82..5d32fe66e 100644 --- a/app/controllers/auth/registrations_controller.rb +++ b/app/controllers/auth/registrations_controller.rb @@ -10,6 +10,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController before_action :configure_sign_up_params, only: [:create] before_action :set_pack before_action :set_sessions, only: [:edit, :update] + before_action :set_strikes, only: [:edit, :update] before_action :set_instance_presenter, only: [:new, :create, :update] before_action :set_body_classes, only: [:new, :create, :edit, :update] before_action :require_not_suspended!, only: [:update] @@ -116,8 +117,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController end def set_invite - invite = invite_code.present? ? Invite.find_by(code: invite_code) : nil - @invite = invite&.valid_for_use? ? invite : nil + @invite = begin + invite = Invite.find_by(code: invite_code) if invite_code.present? + invite if invite&.valid_for_use? + end end def determine_layout @@ -128,6 +131,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController @sessions = current_user.session_activations end + def set_strikes + @strikes = current_account.strikes.active.latest + end + def require_not_suspended! forbidden if current_account.suspended? end |