logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 505e58d4eb84226613c85ac526c591dab5b1307e
parent 0524e66a05170519d22a9bfc096440664ed1cfee
Author: tusooa <tusooa@kazv.moe>
Date:   Mon, 22 May 2023 08:14:20 -0400

Fix ObjectTest

Diffstat:

Mlib/pleroma/object/updater.ex8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/pleroma/object/updater.ex b/lib/pleroma/object/updater.ex @@ -100,12 +100,14 @@ defmodule Pleroma.Object.Updater do end defp maybe_update_poll(to_be_updated, updated_object) do - choice_key = fn data -> - if Map.has_key?(data, "anyOf"), do: "anyOf", else: "oneOf" + choice_key = fn + %{"anyOf" => [_ | _]} = data -> "anyOf" + %{"oneOf" => [_ | _]} = data -> "oneOf" + _ -> nil end with true <- to_be_updated["type"] == "Question", - key <- choice_key.(updated_object), + key when not is_nil(key) <- choice_key.(updated_object), true <- key == choice_key.(to_be_updated), orig_choices <- to_be_updated[key] |> Enum.map(&Map.drop(&1, ["replies"])), new_choices <- updated_object[key] |> Enum.map(&Map.drop(&1, ["replies"])),