Add base CAPTCHA support (currently only kocaptcha)
[akkoma] / lib / pleroma / web / ostatus / ostatus.ex
index 53d71440eb3b416facf9814ed9bbef648a8a430e..c6440c20e9daa1d1248494fb201fe7aed7785b6a 100644 (file)
@@ -375,19 +375,14 @@ defmodule Pleroma.Web.OStatus do
   end
 
   def fetch_activity_from_url(url) do
-    try do
-      with {:ok, activities} when length(activities) > 0 <- fetch_activity_from_atom_url(url) do
-        {:ok, activities}
-      else
-        _e ->
-          with {:ok, activities} <- fetch_activity_from_html_url(url) do
-            {:ok, activities}
-          end
-      end
-    rescue
-      e ->
-        Logger.debug("Couldn't get #{url}: #{inspect(e)}")
-        {:error, "Couldn't get #{url}: #{inspect(e)}"}
+    with {:ok, [_ | _] = activities} <- fetch_activity_from_atom_url(url) do
+      {:ok, activities}
+    else
+      _e -> fetch_activity_from_html_url(url)
     end
+  rescue
+    e ->
+      Logger.debug("Couldn't get #{url}: #{inspect(e)}")
+      {:error, "Couldn't get #{url}: #{inspect(e)}"}
   end
 end