mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-12-23 19:15:10 +01:00
Set updated_at even if the object stayed the same
This commit is contained in:
parent
a9c700ff15
commit
e3f902b3a1
@ -14,11 +14,20 @@ defmodule Pleroma.Object.Fetcher do
|
||||
|
||||
require Logger
|
||||
|
||||
defp touch_changeset(changeset) do
|
||||
updated_at =
|
||||
NaiveDateTime.utc_now()
|
||||
|> NaiveDateTime.truncate(:second)
|
||||
|
||||
Ecto.Changeset.put_change(changeset, :updated_at, updated_at)
|
||||
end
|
||||
|
||||
defp reinject_object(struct, data) do
|
||||
Logger.debug("Reinjecting object #{data["id"]}")
|
||||
|
||||
with data <- Transmogrifier.fix_object(data),
|
||||
changeset <- Object.change(struct, %{data: data}),
|
||||
changeset <- touch_changeset(changeset),
|
||||
{:ok, object} <- Repo.insert_or_update(changeset) do
|
||||
{:ok, object}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user