forked from AkkomaGang/akkoma
Aliases: refactor validate_also_known_as/1
This commit is contained in:
parent
0d6b9ce8ca
commit
4200a06340
1 changed files with 4 additions and 3 deletions
|
@ -2458,9 +2458,10 @@ def sanitize_html(%User{} = user, filter) do
|
|||
|
||||
defp validate_also_known_as(changeset) do
|
||||
validate_change(changeset, :also_known_as, fn :also_known_as, also_known_as ->
|
||||
case Enum.all?(also_known_as, fn a -> Regex.match?(@url_regex, a) end) do
|
||||
true -> []
|
||||
false -> [also_known_as: "Invalid ap_id format. Must be a URL."]
|
||||
if Enum.all?(also_known_as, fn a -> Regex.match?(@url_regex, a) end) do
|
||||
[]
|
||||
else
|
||||
[also_known_as: "Invalid ap_id format. Must be a URL."]
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue