mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-06 00:49:46 +00:00
PollWorker defensive checks
This commit is contained in:
parent
cbd1a10c16
commit
6a6e42c9bf
1 changed files with 4 additions and 2 deletions
|
@ -26,8 +26,10 @@ defmodule Pleroma.Workers.PollWorker do
|
||||||
end
|
end
|
||||||
|
|
||||||
def schedule_poll_end(%Activity{data: %{"type" => "Create"}, id: activity_id} = activity) do
|
def schedule_poll_end(%Activity{data: %{"type" => "Create"}, id: activity_id} = activity) do
|
||||||
with %Object{data: %{"type" => "Question", "closed" => closed}} <- Object.normalize(activity),
|
with %Object{data: %{"type" => "Question", "closed" => closed}} when is_binary(closed) <-
|
||||||
{:ok, end_time} <- NaiveDateTime.from_iso8601(closed) do
|
Object.normalize(activity),
|
||||||
|
{:ok, end_time} <- NaiveDateTime.from_iso8601(closed),
|
||||||
|
:gt <- NaiveDateTime.compare(end_time, NaiveDateTime.utc_now()) do
|
||||||
%{
|
%{
|
||||||
op: "poll_end",
|
op: "poll_end",
|
||||||
activity_id: activity_id
|
activity_id: activity_id
|
||||||
|
|
Loading…
Reference in a new issue