Unify the logic of updating objects

This commit is contained in:
Tusooa Zhu 2022-06-25 00:32:22 -04:00
commit 99a6f50316
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
6 changed files with 183 additions and 101 deletions

View file

@ -50,7 +50,14 @@ defmodule Pleroma.Object.Fetcher do
Pleroma.Constants.status_updatable_fields()
|> Enum.any?(fn field -> Map.get(old_data, field) != Map.get(new_data, field) end)
new_data |> Object.maybe_update_history(old_data, changed?)
%{updated_object: updated_object} =
new_data
|> Object.Updater.maybe_update_history(old_data,
updated: changed?,
use_history_in_new_object?: false
)
updated_object
else
new_data
end