Display a helpful error message when join code is exhausted

ref: https://app.fizzy.do/5986089/cards/3015
This commit is contained in:
Mike Dalessio
2025-11-19 15:49:58 -05:00
parent 1382920e9b
commit c53b56c1db
3 changed files with 23 additions and 3 deletions
+6 -2
View File
@@ -29,10 +29,14 @@ class JoinCodesController < ApplicationController
private
def set_join_code
@join_code ||= Account::JoinCode.active.find_by(code: params.expect(:code), account: Current.account)
@join_code ||= Account::JoinCode.find_by(code: params.expect(:code), account: Current.account)
end
def ensure_join_code_is_valid
head :not_found unless @join_code&.active?
if @join_code.nil?
head :not_found
elsif !@join_code.active?
render :inactive, status: :gone
end
end
end