show error page puzzle link only for premium users

This commit is contained in:
2026-11-06 15:47:53 +01:00
parent 785e403370
commit bf176ebd42
9 changed files with 53 additions and 13 deletions
+9
View File
@@ -30,4 +30,13 @@ defmodule Chesstrainer.Accounts.Scope do
end
def for_user(nil), do: nil
@doc """
True when the scope belongs to a premium user.
`for_user/1` returns `nil` for anonymous visitors, so the catch-all covers
both nil scopes and free plans.
"""
def premium?(%__MODULE__{user: %User{plan: :premium}}), do: true
def premium?(_scope), do: false
end