inReplyTo can be empty
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
b2db190056
commit
af8b3a7173
|
@ -146,22 +146,25 @@ defmodule Mobilizon.Service.ActivityPub.Utils do
|
||||||
}
|
}
|
||||||
|
|
||||||
# We fetch the parent object
|
# We fetch the parent object
|
||||||
data =
|
unless !Map.has_key?("inReplyTo") || object_data["inReplyTo"] == nil ||
|
||||||
case ActivityPub.fetch_object_from_url(object_data["inReplyTo"]) do
|
object_data["inReplyTo"] == "" do
|
||||||
# Reply to an event (Comment)
|
data =
|
||||||
{:ok, %Event{id: id}} ->
|
case ActivityPub.fetch_object_from_url(object_data["inReplyTo"]) do
|
||||||
data |> Map.put("event_id", id)
|
# Reply to an event (Comment)
|
||||||
|
{:ok, %Event{id: id}} ->
|
||||||
|
data |> Map.put("event_id", id)
|
||||||
|
|
||||||
# Reply to a comment (Comment)
|
# Reply to a comment (Comment)
|
||||||
{:ok, %Comment{id: id} = comment} ->
|
{:ok, %Comment{id: id} = comment} ->
|
||||||
data
|
data
|
||||||
|> Map.put("in_reply_to_comment_id", id)
|
|> Map.put("in_reply_to_comment_id", id)
|
||||||
|> Map.put("origin_comment_id", comment |> Comment.get_thread_id())
|
|> Map.put("origin_comment_id", comment |> Comment.get_thread_id())
|
||||||
|
|
||||||
# Anthing else is kind of a MP
|
# Anthing else is kind of a MP
|
||||||
_ ->
|
_ ->
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
Logger.info("comment data ready to be inserted")
|
Logger.info("comment data ready to be inserted")
|
||||||
|
|
Loading…
Reference in a new issue