@moduledoc """
A module to handle coding from internal to wire ActivityPub and back.
"""
- alias Pleroma.User
- alias Pleroma.Object
- alias Pleroma.Object.Containment
alias Pleroma.Activity
alias Pleroma.Object
+ alias Pleroma.Object.Containment
alias Pleroma.Repo
alias Pleroma.User
+ alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Visibility
context,
content_html,
attachments,
- inReplyTo,
+ in_reply_to,
tags,
cw \\ nil,
cc \\ []
"tag" => tags |> Enum.map(fn {_, tag} -> tag end) |> Enum.uniq()
}
- if inReplyTo do
- inReplyToObject = Object.normalize(inReplyTo.data["object"])
+ if in_reply_to do
+ in_reply_to_object = Object.normalize(inReplyTo.data["object"])
object
- |> Map.put("inReplyTo", inReplyToObject.data["id"])
+ |> Map.put("inReplyTo", in_reply_to_object.data["id"])
else
object
end
defmodule Pleroma.Web.Federator do
alias Pleroma.Activity
+ alias Pleroma.Object.Containment
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Relay
alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.Federator.RetryQueue
alias Pleroma.Web.OStatus
- alias Pleroma.Object.Containment
alias Pleroma.Web.Salmon
alias Pleroma.Web.WebFinger
alias Pleroma.Web.Websub
defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
use Pleroma.Web, :controller
- alias Pleroma.Object.Fetcher
alias Ecto.Changeset
alias Pleroma.Activity
alias Pleroma.Config
alias Pleroma.Filter
alias Pleroma.Notification
alias Pleroma.Object
+ alias Pleroma.Object.Fetcher
alias Pleroma.Pagination
alias Pleroma.Repo
alias Pleroma.ScheduledActivity
alias Pleroma.Activity
alias Pleroma.HTML
- alias Pleroma.Repo
alias Pleroma.Object
+ alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.CommonAPI.Utils
defmodule Pleroma.Object.ContainmentTest do
use Pleroma.DataCase
- alias Pleroma.User
alias Pleroma.Object.Containment
+ alias Pleroma.User
import Pleroma.Factory
defmodule Pleroma.ObjectTest do
use Pleroma.DataCase
import Pleroma.Factory
+ import Tesla.Mock
alias Pleroma.Object
alias Pleroma.Repo
+ setup do
+ mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
+ :ok
+ end
+
test "returns an object by it's AP id" do
object = insert(:note)
found_object = Object.get_by_ap_id(object.data["id"])
defmodule Pleroma.Web.CommonAPITest do
use Pleroma.DataCase
alias Pleroma.Activity
- alias Pleroma.User
alias Pleroma.Object
+ alias Pleroma.User
alias Pleroma.Web.CommonAPI
import Pleroma.Factory
use Pleroma.DataCase
alias Pleroma.Activity
- alias Pleroma.User
- alias Pleroma.Repo
alias Pleroma.Object
+ alias Pleroma.Repo
+ alias Pleroma.User
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.AccountView