From 80743a50f71a2bf6c91934a48eaf2380995aa41c Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Thu, 29 Aug 2024 00:38:29 +0500 Subject: [PATCH] refactor: simplify changeset checks, enable spellcheck --- lib/comfycamp/accounts/user.ex | 7 +------ lib/comfycamp_web/live/user_registration_live.ex | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/comfycamp/accounts/user.ex b/lib/comfycamp/accounts/user.ex index 7ba3c80..b0279e7 100644 --- a/lib/comfycamp/accounts/user.ex +++ b/lib/comfycamp/accounts/user.ex @@ -42,7 +42,7 @@ defmodule Comfycamp.Accounts.User do |> cast(attrs, [:email, :password, :info]) |> validate_email(opts) |> validate_password(opts) - |> validate_info() + |> validate_length(:info, min: 2, max: 4096) end defp validate_email(changeset, opts) do @@ -89,11 +89,6 @@ defmodule Comfycamp.Accounts.User do end end - defp validate_info(changeset) do - changeset - |> validate_length(:info, max: 4096) - end - @doc """ A user changeset for changing the email. diff --git a/lib/comfycamp_web/live/user_registration_live.ex b/lib/comfycamp_web/live/user_registration_live.ex index 384a186..5703c68 100644 --- a/lib/comfycamp_web/live/user_registration_live.ex +++ b/lib/comfycamp_web/live/user_registration_live.ex @@ -37,6 +37,7 @@ defmodule ComfycampWeb.UserRegistrationLive do field={@form[:info]} type="textarea" label="Почему вы хотите получить доступ?" + spellcheck="true" required />