handle empty last_fetch
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending approval
ci/woodpecker/pr/build-arm64 Pipeline is pending approval
ci/woodpecker/pr/docs Pipeline is pending approval
ci/woodpecker/pr/lint Pipeline is pending approval
ci/woodpecker/pr/test Pipeline is pending approval
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending approval
ci/woodpecker/pr/build-arm64 Pipeline is pending approval
ci/woodpecker/pr/docs Pipeline is pending approval
ci/woodpecker/pr/lint Pipeline is pending approval
ci/woodpecker/pr/test Pipeline is pending approval
This commit is contained in:
parent
ee1f8938fc
commit
488d4b7c2e
2 changed files with 8 additions and 3 deletions
|
@ -211,14 +211,14 @@ defp log_fetch_error(id, error) do
|
||||||
end
|
end
|
||||||
|
|
||||||
# if its already an activity, dont wrap
|
# if its already an activity, dont wrap
|
||||||
defp prepare_activity_params(%{"object" => _ } = data), do: data
|
defp prepare_activity_params(%{"object" => _} = data), do: data
|
||||||
|
|
||||||
defp prepare_activity_params(data) do
|
defp prepare_activity_params(data) do
|
||||||
%{
|
%{
|
||||||
"type" => "Create",
|
"type" => "Create",
|
||||||
# Should we seriously keep this attributedTo thing?
|
# Should we seriously keep this attributedTo thing?
|
||||||
"actor" => data["actor"] || data["attributedTo"],
|
"actor" => data["actor"] || data["attributedTo"],
|
||||||
"object" => data,
|
"object" => data
|
||||||
}
|
}
|
||||||
|> Maps.put_if_present("to", data["to"])
|
|> Maps.put_if_present("to", data["to"])
|
||||||
|> Maps.put_if_present("cc", data["cc"])
|
|> Maps.put_if_present("cc", data["cc"])
|
||||||
|
|
|
@ -1862,7 +1862,12 @@ def enqueue_outbox_fetches(
|
||||||
%{outbox: outbox_address, last_outbox_fetch: last_fetch, local: false} = user
|
%{outbox: outbox_address, last_outbox_fetch: last_fetch, local: false} = user
|
||||||
) do
|
) do
|
||||||
with(
|
with(
|
||||||
last_fetch <- last_fetch.to_unix(),
|
last_fetch <-
|
||||||
|
if last_fetch == nil do
|
||||||
|
0
|
||||||
|
else
|
||||||
|
last_fetch.to_unix()
|
||||||
|
end,
|
||||||
now <- DateTime.utc_now().to_unix(),
|
now <- DateTime.utc_now().to_unix(),
|
||||||
# future => epoch stuff, let it pass
|
# future => epoch stuff, let it pass
|
||||||
# >60 secs in past => ok
|
# >60 secs in past => ok
|
||||||
|
|
Loading…
Reference in a new issue