From 8112173ef46ff3ef56fd19910cca78cb28437f98 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 16 Sep 2025 09:44:11 +0000 Subject: [PATCH] refactor: rename mail_allowlisted to signup_allowed? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow Elixir naming conventions by using question mark suffix for boolean functions. Renamed mail_allowlisted to signup_allowed? and mail_allowlisted_fun to signup_allowed_fun throughout the codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- lib/basic_signup_allowlist.ex | 8 ++++---- lib/fun_core/basic_signup_allowlist.ex | 2 +- test/basic_signup_allowlist_test.exs | 4 ++-- test/fun_core/basic_signup_allowlist_test.exs | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/basic_signup_allowlist.ex b/lib/basic_signup_allowlist.ex index d76026f..263e372 100644 --- a/lib/basic_signup_allowlist.ex +++ b/lib/basic_signup_allowlist.ex @@ -26,15 +26,15 @@ defmodule BasicSignupAllowlist do ## Examples iex> System.delete_env("SIGNUP_ALLOWLIST_EMAILS") - iex> BasicSignupAllowlist.mail_allowlisted("joe@example.com") + iex> BasicSignupAllowlist.signup_allowed?("joe@example.com") false iex> System.put_env("SIGNUP_ALLOWLIST_EMAILS","*") - iex> BasicSignupAllowlist.mail_allowlisted("joe@example.com") + iex> BasicSignupAllowlist.signup_allowed?("joe@example.com") true """ - def mail_allowlisted(email) do + def signup_allowed?(email) do env_value = System.get_env(@signup_allowlist_emails) - mail_allowlisted_fun(env_value, email) + signup_allowed_fun(env_value, email) end end diff --git a/lib/fun_core/basic_signup_allowlist.ex b/lib/fun_core/basic_signup_allowlist.ex index 33dc034..8e8f2e4 100644 --- a/lib/fun_core/basic_signup_allowlist.ex +++ b/lib/fun_core/basic_signup_allowlist.ex @@ -9,7 +9,7 @@ defmodule FunCore.BasicSignupAllowlist do |> Enum.map(&normalize/1) end - def mail_allowlisted_fun(signups_allowed, email_received) do + def signup_allowed_fun(signups_allowed, email_received) do case signups_allowed do nil -> false "*" -> true diff --git a/test/basic_signup_allowlist_test.exs b/test/basic_signup_allowlist_test.exs index 38fa6e2..6e28f87 100644 --- a/test/basic_signup_allowlist_test.exs +++ b/test/basic_signup_allowlist_test.exs @@ -18,12 +18,12 @@ defmodule BasicSignupAllowlistTest do test "When not set, not allowlisted" do System.delete_env(BasicSignupAllowlist.signup_allowlist_emails()) - refute BasicSignupAllowlist.mail_allowlisted("joe@example.com") + refute BasicSignupAllowlist.signup_allowed?("joe@example.com") end test "When set to star, allowlisted" do allow_signups_for("*") - assert BasicSignupAllowlist.mail_allowlisted("joe@example.com") + assert BasicSignupAllowlist.signup_allowed?("joe@example.com") end end end diff --git a/test/fun_core/basic_signup_allowlist_test.exs b/test/fun_core/basic_signup_allowlist_test.exs index 9f364b5..c349eb8 100644 --- a/test/fun_core/basic_signup_allowlist_test.exs +++ b/test/fun_core/basic_signup_allowlist_test.exs @@ -16,25 +16,25 @@ defmodule FunCore.BasicSignupAllowlistTest do describe "Not allowlisted when allowed list is" do test "not set" do - refute(mail_allowlisted_fun(nil, "joe@example.com")) + refute(signup_allowed_fun(nil, "joe@example.com")) end test "empty" do - refute(mail_allowlisted_fun("j", "joe@example.com")) + refute(signup_allowed_fun("j", "joe@example.com")) end end describe "Allowlisted when" do test "*" do - assert(mail_allowlisted_fun("*", "jane@example.com")) + assert(signup_allowed_fun("*", "jane@example.com")) end test "Multiple set and one match" do - assert(mail_allowlisted_fun("joe@example.com, jane@example.com", "jane@example.com")) + assert(signup_allowed_fun("joe@example.com, jane@example.com", "jane@example.com")) end test "Matches with different casings" do - assert(mail_allowlisted_fun("joe@Example.com, jane@example.com", "Joe@example.com")) + assert(signup_allowed_fun("joe@Example.com, jane@example.com", "Joe@example.com")) end end end