Refactor Mobilizon.Federation.ActivityPub and add typespecs
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user