Fix conflict
[akkoma] / lib / pleroma / web / common_api / common_api.ex
index a12ee011bef12711c75ce0871ec60f700fcb4063..ad3c03c55dee450a8d5006453f37d177f10ea4b1 100644 (file)
@@ -132,19 +132,22 @@ defmodule Pleroma.Web.CommonAPI do
         Enum.map(choices, fn index ->
           answer_data = make_answer_data(user, object, Enum.at(options, index)["name"])
 
-          ActivityPub.create(%{
-            to: answer_data["to"],
-            actor: user,
-            context: object.data["context"],
-            object: answer_data,
-            additional: %{"cc" => answer_data["cc"]}
-          })
+          {:ok, activity} =
+            ActivityPub.create(%{
+              to: answer_data["to"],
+              actor: user,
+              context: object.data["context"],
+              object: answer_data,
+              additional: %{"cc" => answer_data["cc"]}
+            })
+
+          activity
         end)
 
       object = Object.get_cached_by_ap_id(object.data["id"])
       {:ok, answer_activities, object}
     else
-      {:author, _} -> {:error, "Already voted"}
+      {:author, _} -> {:error, "Poll's author can't vote"}
       {:existing_votes, _} -> {:error, "Already voted"}
       {:choice_check, {_, false}} -> {:error, "Invalid indices"}
       {:count_check, false} -> {:error, "Too many choices"}