Refactor Mobilizon.Federation.ActivityPub and add typespecs

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-09-28 19:40:37 +02:00
parent 41f086e2c9
commit b5d9b82bdd
125 changed files with 2497 additions and 1673 deletions

View File

@@ -23,6 +23,7 @@ defmodule Mobilizon.Actors.Actor do
require Logger
@type t :: %__MODULE__{
id: integer(),
url: String.t(),
outbox_url: String.t(),
inbox_url: String.t(),

View File

@@ -299,6 +299,7 @@ defmodule Mobilizon.Actors do
@delete_actor_default_options [reserve_username: true, suspension: false]
@spec delete_actor(Actor.t(), Keyword.t()) :: {:error, Ecto.Changeset.t()} | {:ok, Oban.Job.t()}
def delete_actor(%Actor{} = actor, options \\ @delete_actor_default_options) do
delete_actor_options = Keyword.merge(@delete_actor_default_options, options)
@@ -533,7 +534,7 @@ defmodule Mobilizon.Actors do
|> Repo.one()
end
@spec get_actor_by_followers_url(String.t()) :: Actor.t()
@spec get_actor_by_followers_url(String.t()) :: Actor.t() | nil
def get_actor_by_followers_url(followers_url) do
Actor
|> where([q], q.followers_url == ^followers_url)

View File

@@ -12,6 +12,8 @@ defmodule Mobilizon.Actors.Member do
alias Mobilizon.Web.Endpoint
@type t :: %__MODULE__{
id: String.t(),
url: String.t(),
role: MemberRole.t(),
parent: Actor.t(),
actor: Actor.t(),