Fix the old poll votes count bug

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-20 12:01:41 +02:00
parent 2cdc1985a5
commit 46dc19275b

View file

@ -5,6 +5,7 @@
defmodule Pleroma.Object.Updater do
require Pleroma.Constants
alias Pleroma.Maps
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.Workers.EventReminderWorker
@ -116,6 +117,7 @@ defp maybe_update_poll(to_be_updated, updated_object) do
# Choices are the same, but counts are different
to_be_updated
|> Map.put(key, updated_object[key])
|> Maps.put_if_present("votersCount", updated_object["votersCount"])
else
# Choices (or vote type) have changed, do not allow this
_ -> to_be_updated