|> validate_length(:bio, max: bio_limit)
|> validate_length(:name, max: name_limit)
|> validate_fields(true)
+ |> validate_non_local()
+ end
+
+ defp validate_non_local(cng) do
+ local? = get_field(cng, :local)
+
+ if local? do
+ cng
+ |> add_error(:local, "User is local, can't update with this changeset.")
+ else
+ cng
+ end
end
def update_changeset(struct, params \\ %{}) do
|> Map.put(:bio, HTML.filter_tags(user.bio, filter))
|> Map.put(:fields, fields)
end
+
+ def get_host(%User{ap_id: ap_id} = _user) do
+ URI.parse(ap_id).host
+ end
end