summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2020-12-31 12:53:28 -0600
committerAlex Gleason <alex@alexgleason.me>2020-12-31 12:53:28 -0600
commit4200a063408966b1e14e79b18c96ce59af23ec35 (patch)
treebfe9fdc805dc5747387eb9a77c9253606ba2c4c3
parent0d6b9ce8ca5afd1ddaa0af4061fd956b29d17826 (diff)
Aliases: refactor validate_also_known_as/1
-rw-r--r--lib/pleroma/user.ex7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 7b26ac7a3..230845662 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -2458,9 +2458,10 @@ defmodule Pleroma.User 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