Fix things with in_reply_to_comment_id

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-11-08 15:57:46 +01:00
parent 537736a98e
commit 04e342c897
3 changed files with 30 additions and 3 deletions

View File

@@ -50,6 +50,8 @@ defmodule Mobilizon.Service.ActivityPub do
@spec fetch_object_from_url(String.t()) :: tuple()
def fetch_object_from_url(url) do
with true <- String.starts_with?(url, "http"),
nil <- Events.get_event_by_url(url),
nil <- Events.get_comment_from_url(url),
{:ok, %{body: body, status_code: code}} when code in 200..299 <-
HTTPoison.get(
url,
@@ -59,8 +61,6 @@ defmodule Mobilizon.Service.ActivityPub do
recv_timeout: 20_000
),
{:ok, data} <- Jason.decode(body),
nil <- Events.get_event_by_url(data["id"]),
nil <- Events.get_comment_from_url(data["id"]),
params <- %{
"type" => "Create",
"to" => data["to"],