Fix crash in join code redemption race condition

This commit is contained in:
Stanko K.R.
2025-12-03 13:27:15 +01:00
parent def487208c
commit 6e9381abb8
6 changed files with 42 additions and 25 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ class JoinCodesController < ApplicationController
def create
identity = Identity.find_or_create_by!(email_address: params.expect(:email_address))
@join_code.redeem { |account| identity.join(account) } unless identity.member_of?(@join_code.account)
@join_code.redeem_if { |account| identity.join(account) }
user = User.active.find_by!(account: @join_code.account, identity: identity)
if identity == Current.identity && user.setup?