Don't try to fetch OP if none is there.
This commit is contained in:
parent
d2099c849d
commit
ff7afe46b9
|
@ -73,7 +73,11 @@ def render("status.json", %{activity: %{data: %{"object" => object}} = activity}
|
|||
created_at = Utils.to_masto_date(object["published"])
|
||||
|
||||
# TODO: Add cached version.
|
||||
reply_to = Activity.get_create_activity_by_object_ap_id(object["inReplyTo"])
|
||||
reply_to = if object["inReplyTo"] && object["inReplyTo"] != "" do
|
||||
Activity.get_create_activity_by_object_ap_id(object["inReplyTo"])
|
||||
else
|
||||
nil
|
||||
end
|
||||
reply_to_user = reply_to && User.get_cached_by_ap_id(reply_to.data["actor"])
|
||||
|
||||
emojis = (activity.data["object"]["emoji"] || [])
|
||||
|
|
|
@ -54,6 +54,14 @@ test "a note activity" do
|
|||
assert status == expected
|
||||
end
|
||||
|
||||
test "a reply" do
|
||||
note = insert(:note_activity)
|
||||
user = insert(:user)
|
||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "he", "in_reply_to_status_id" => note.id})
|
||||
|
||||
assert activity.data["object"]["inReplyTo"] == note.data["object"]["id"]
|
||||
end
|
||||
|
||||
test "contains mentions" do
|
||||
incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml")
|
||||
# a user with this ap id might be in the cache.
|
||||
|
|
Loading…
Reference in New Issue