Add `account_activation_required` to /api/v1/instance
[akkoma] / lib / pleroma / web / activity_pub / object_validators / types / object_id.ex
index ee10be0b0d0417d7672bdbc5f1748901640757cf..f71f763704be08664ec3b3b0c3461d7c6c008e9c 100644 (file)
@@ -6,28 +6,18 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.ObjectID do
   def cast(object) when is_binary(object) do
     # Host has to be present and scheme has to be an http scheme (for now)
     case URI.parse(object) do
-      %URI{host: nil} ->
-        :error
-
-      %URI{scheme: scheme} when scheme in ["https", "http"] ->
-        {:ok, object}
-
-      _ ->
-        :error
+      %URI{host: nil} -> :error
+      %URI{host: ""} -> :error
+      %URI{scheme: scheme} when scheme in ["https", "http"] -> {:ok, object}
+      _ -> :error
     end
   end
 
   def cast(%{"id" => object}), do: cast(object)
 
-  def cast(_) do
-    :error
-  end
+  def cast(_), do: :error
 
-  def dump(data) do
-    {:ok, data}
-  end
+  def dump(data), do: {:ok, data}
 
-  def load(data) do
-    {:ok, data}
-  end
+  def load(data), do: {:ok, data}
 end