Merge branch 'feature/update-welcome-setting-in-description' into 'develop'
[akkoma] / lib / pleroma / web / activity_pub / object_validators / question_validator.ex
index 694cb673052413d0d85777f2da9e5af5278e18e0..f47acf606aabd89ddc756f83176db4f4db48e628 100644 (file)
@@ -83,17 +83,23 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
 
   # based on Pleroma.Web.ActivityPub.Utils.lazy_put_objects_defaults
   defp fix_defaults(data) do
-    %{data: %{"id" => context}, id: context_id} = Utils.create_context(data["context"])
+    %{data: %{"id" => context}, id: context_id} =
+      Utils.create_context(data["context"] || data["conversation"])
 
     data
-    |> Map.put_new_lazy("id", &Utils.generate_object_id/0)
     |> Map.put_new_lazy("published", &Utils.make_date/0)
     |> Map.put_new("context", context)
     |> Map.put_new("context_id", context_id)
   end
 
+  defp fix_attribution(data) do
+    data
+    |> Map.put_new("actor", data["attributedTo"])
+  end
+
   defp fix(data) do
     data
+    |> fix_attribution()
     |> fix_closed()
     |> fix_defaults()
   end