Move API under GraphQL context
This commit is contained in:
parent
ba3ad713c0
commit
b3f8d52bc9
|
@ -30,7 +30,8 @@ defmodule Mobilizon.Federation.ActivityPub do
|
||||||
alias Mobilizon.Federation.HTTPSignatures.Signature
|
alias Mobilizon.Federation.HTTPSignatures.Signature
|
||||||
alias Mobilizon.Federation.WebFinger
|
alias Mobilizon.Federation.WebFinger
|
||||||
|
|
||||||
alias MobilizonWeb.API.Utils, as: APIUtils
|
alias Mobilizon.GraphQL.API.Utils, as: APIUtils
|
||||||
|
|
||||||
alias MobilizonWeb.Email.{Admin, Mailer}
|
alias MobilizonWeb.Email.{Admin, Mailer}
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
|
@ -15,7 +15,7 @@ defmodule Mobilizon.Federation.ActivityPub.Relay do
|
||||||
alias Mobilizon.Federation.ActivityPub.{Activity, Transmogrifier}
|
alias Mobilizon.Federation.ActivityPub.{Activity, Transmogrifier}
|
||||||
alias Mobilizon.Federation.WebFinger
|
alias Mobilizon.Federation.WebFinger
|
||||||
|
|
||||||
alias MobilizonWeb.API.Follows
|
alias Mobilizon.GraphQL.API.Follows
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
defmodule MobilizonWeb.API.Comments do
|
defmodule Mobilizon.GraphQL.API.Comments do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Comments.
|
API for Comments.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Events.Comment
|
alias Mobilizon.Events.Comment
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub
|
alias Mobilizon.Federation.ActivityPub
|
||||||
|
@ -12,8 +13,7 @@ defmodule MobilizonWeb.API.Comments do
|
||||||
|
|
||||||
Creates a comment from an actor
|
Creates a comment from an actor
|
||||||
"""
|
"""
|
||||||
@spec create_comment(map()) ::
|
@spec create_comment(map) :: {:ok, Activity.t(), Comment.t()} | any
|
||||||
{:ok, Activity.t(), Comment.t()} | any()
|
|
||||||
def create_comment(args) do
|
def create_comment(args) do
|
||||||
ActivityPub.create(:comment, args, true)
|
ActivityPub.create(:comment, args, true)
|
||||||
end
|
end
|
||||||
|
@ -23,8 +23,7 @@ defmodule MobilizonWeb.API.Comments do
|
||||||
|
|
||||||
Deletes a comment from an actor
|
Deletes a comment from an actor
|
||||||
"""
|
"""
|
||||||
@spec delete_comment(Comment.t()) ::
|
@spec delete_comment(Comment.t()) :: {:ok, Activity.t(), Comment.t()} | any
|
||||||
{:ok, Activity.t(), Comment.t()} | any()
|
|
||||||
def delete_comment(%Comment{} = comment) do
|
def delete_comment(%Comment{} = comment) do
|
||||||
ActivityPub.delete(comment, true)
|
ActivityPub.delete(comment, true)
|
||||||
end
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.Events do
|
defmodule Mobilizon.GraphQL.API.Events do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Events.
|
API for Events.
|
||||||
"""
|
"""
|
||||||
|
@ -12,7 +12,7 @@ defmodule MobilizonWeb.API.Events do
|
||||||
@doc """
|
@doc """
|
||||||
Create an event
|
Create an event
|
||||||
"""
|
"""
|
||||||
@spec create_event(map()) :: {:ok, Activity.t(), Event.t()} | any()
|
@spec create_event(map) :: {:ok, Activity.t(), Event.t()} | any
|
||||||
def create_event(args) do
|
def create_event(args) do
|
||||||
with organizer_actor <- Map.get(args, :organizer_actor),
|
with organizer_actor <- Map.get(args, :organizer_actor),
|
||||||
args <-
|
args <-
|
||||||
|
@ -27,7 +27,7 @@ defmodule MobilizonWeb.API.Events do
|
||||||
@doc """
|
@doc """
|
||||||
Update an event
|
Update an event
|
||||||
"""
|
"""
|
||||||
@spec update_event(map(), Event.t()) :: {:ok, Activity.t(), Event.t()} | any()
|
@spec update_event(map, Event.t()) :: {:ok, Activity.t(), Event.t()} | any
|
||||||
def update_event(args, %Event{} = event) do
|
def update_event(args, %Event{} = event) do
|
||||||
with organizer_actor <- Map.get(args, :organizer_actor),
|
with organizer_actor <- Map.get(args, :organizer_actor),
|
||||||
args <-
|
args <-
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.Follows do
|
defmodule Mobilizon.GraphQL.API.Follows do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Common API for following, unfollowing, accepting and rejecting stuff.
|
Common API for following, unfollowing, accepting and rejecting stuff.
|
||||||
"""
|
"""
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.Groups do
|
defmodule Mobilizon.GraphQL.API.Groups do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Groups.
|
API for Groups.
|
||||||
"""
|
"""
|
||||||
|
@ -12,7 +12,7 @@ defmodule MobilizonWeb.API.Groups do
|
||||||
@doc """
|
@doc """
|
||||||
Create a group
|
Create a group
|
||||||
"""
|
"""
|
||||||
@spec create_group(map()) :: {:ok, Activity.t(), Actor.t()} | any()
|
@spec create_group(map) :: {:ok, Activity.t(), Actor.t()} | any
|
||||||
def create_group(args) do
|
def create_group(args) do
|
||||||
with preferred_username <-
|
with preferred_username <-
|
||||||
args |> Map.get(:preferred_username) |> HtmlSanitizeEx.strip_tags() |> String.trim(),
|
args |> Map.get(:preferred_username) |> HtmlSanitizeEx.strip_tags() |> String.trim(),
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.Participations do
|
defmodule Mobilizon.GraphQL.API.Participations do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Common API to join events and groups.
|
Common API to join events and groups.
|
||||||
"""
|
"""
|
||||||
|
@ -27,11 +27,13 @@ defmodule MobilizonWeb.API.Participations do
|
||||||
@doc """
|
@doc """
|
||||||
Update participation status
|
Update participation status
|
||||||
"""
|
"""
|
||||||
def update(%Participant{} = participation, %Actor{} = moderator, :participant),
|
def update(%Participant{} = participation, %Actor{} = moderator, :participant) do
|
||||||
do: accept(participation, moderator)
|
accept(participation, moderator)
|
||||||
|
end
|
||||||
|
|
||||||
def update(%Participant{} = participation, %Actor{} = moderator, :rejected),
|
def update(%Participant{} = participation, %Actor{} = moderator, :rejected) do
|
||||||
do: reject(participation, moderator)
|
reject(participation, moderator)
|
||||||
|
end
|
||||||
|
|
||||||
defp accept(
|
defp accept(
|
||||||
%Participant{} = participation,
|
%Participant{} = participation,
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.Reports do
|
defmodule Mobilizon.GraphQL.API.Reports do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Reports.
|
API for Reports.
|
||||||
"""
|
"""
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.Search do
|
defmodule Mobilizon.GraphQL.API.Search do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for search.
|
API for search.
|
||||||
"""
|
"""
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.Utils do
|
defmodule Mobilizon.GraphQL.API.Utils do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Utils for API.
|
Utils for API.
|
||||||
"""
|
"""
|
||||||
|
@ -10,11 +10,7 @@ defmodule MobilizonWeb.API.Utils do
|
||||||
Creates HTML content from text and mentions
|
Creates HTML content from text and mentions
|
||||||
"""
|
"""
|
||||||
@spec make_content_html(String.t(), list(), String.t()) :: String.t()
|
@spec make_content_html(String.t(), list(), String.t()) :: String.t()
|
||||||
def make_content_html(
|
def make_content_html(text, additional_tags, content_type) do
|
||||||
text,
|
|
||||||
additional_tags,
|
|
||||||
content_type
|
|
||||||
) do
|
|
||||||
with {text, mentions, tags} <- format_input(text, content_type, []) do
|
with {text, mentions, tags} <- format_input(text, content_type, []) do
|
||||||
{text, mentions, additional_tags ++ Enum.map(tags, fn {_, tag} -> tag end)}
|
{text, mentions, additional_tags ++ Enum.map(tags, fn {_, tag} -> tag end)}
|
||||||
end
|
end
|
||||||
|
@ -24,9 +20,7 @@ defmodule MobilizonWeb.API.Utils do
|
||||||
text
|
text
|
||||||
|> Formatter.html_escape("text/plain")
|
|> Formatter.html_escape("text/plain")
|
||||||
|> Formatter.linkify(options)
|
|> Formatter.linkify(options)
|
||||||
|> (fn {text, mentions, tags} ->
|
|> (fn {text, mentions, tags} -> {String.replace(text, ~r/\r?\n/, "<br>"), mentions, tags} end).()
|
||||||
{String.replace(text, ~r/\r?\n/, "<br>"), mentions, tags}
|
|
||||||
end).()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_input(text, "text/html", options) do
|
def format_input(text, "text/html", options) do
|
|
@ -9,7 +9,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Comment do
|
||||||
alias Mobilizon.Events.Comment, as: CommentModel
|
alias Mobilizon.Events.Comment, as: CommentModel
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
alias MobilizonWeb.API.Comments
|
alias Mobilizon.GraphQL.API.Comments
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,11 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
|
||||||
alias Mobilizon.Events.{Event, Participant, EventParticipantStats}
|
alias Mobilizon.Events.{Event, Participant, EventParticipantStats}
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
|
alias Mobilizon.GraphQL.API
|
||||||
alias Mobilizon.GraphQL.Resolvers.Person
|
alias Mobilizon.GraphQL.Resolvers.Person
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub.Activity
|
alias Mobilizon.Federation.ActivityPub.Activity
|
||||||
|
|
||||||
alias MobilizonWeb.API
|
|
||||||
|
|
||||||
# We limit the max number of events that can be retrieved
|
# We limit the max number of events that can be retrieved
|
||||||
@event_max_limit 100
|
@event_max_limit 100
|
||||||
@number_of_related_events 3
|
@number_of_related_events 3
|
||||||
|
@ -231,7 +230,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
|
||||||
{:actor_approve_permission,
|
{:actor_approve_permission,
|
||||||
Mobilizon.Events.moderator_for_event?(participation.event.id, moderator_actor_id)},
|
Mobilizon.Events.moderator_for_event?(participation.event.id, moderator_actor_id)},
|
||||||
{:ok, _activity, participation} <-
|
{:ok, _activity, participation} <-
|
||||||
MobilizonWeb.API.Participations.update(participation, moderator_actor, new_role) do
|
API.Participations.update(participation, moderator_actor, new_role) do
|
||||||
{:ok, participation}
|
{:ok, participation}
|
||||||
else
|
else
|
||||||
{:is_owned, nil} ->
|
{:is_owned, nil} ->
|
||||||
|
@ -268,7 +267,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
|
||||||
{:is_owned, %Actor{} = organizer_actor} <- User.owns_actor(user, organizer_actor_id),
|
{:is_owned, %Actor{} = organizer_actor} <- User.owns_actor(user, organizer_actor_id),
|
||||||
args_with_organizer <- Map.put(args, :organizer_actor, organizer_actor),
|
args_with_organizer <- Map.put(args, :organizer_actor, organizer_actor),
|
||||||
{:ok, %Activity{data: %{"object" => %{"type" => "Event"}}}, %Event{} = event} <-
|
{:ok, %Activity{data: %{"object" => %{"type" => "Event"}}}, %Event{} = event} <-
|
||||||
MobilizonWeb.API.Events.create_event(args_with_organizer) do
|
API.Events.create_event(args_with_organizer) do
|
||||||
{:ok, event}
|
{:ok, event}
|
||||||
else
|
else
|
||||||
{:is_owned, nil} ->
|
{:is_owned, nil} ->
|
||||||
|
@ -302,7 +301,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
|
||||||
User.owns_actor(user, organizer_actor_id),
|
User.owns_actor(user, organizer_actor_id),
|
||||||
args <- Map.put(args, :organizer_actor, organizer_actor),
|
args <- Map.put(args, :organizer_actor, organizer_actor),
|
||||||
{:ok, %Activity{data: %{"object" => %{"type" => "Event"}}}, %Event{} = event} <-
|
{:ok, %Activity{data: %{"object" => %{"type" => "Event"}}}, %Event{} = event} <-
|
||||||
MobilizonWeb.API.Events.update_event(args, event) do
|
API.Events.update_event(args, event) do
|
||||||
{:ok, event}
|
{:ok, event}
|
||||||
else
|
else
|
||||||
{:error, :event_not_found} ->
|
{:error, :event_not_found} ->
|
||||||
|
@ -360,7 +359,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_delete_event(event, federate \\ true) when is_boolean(federate) do
|
defp do_delete_event(event, federate \\ true) when is_boolean(federate) do
|
||||||
with {:ok, _activity, event} <- MobilizonWeb.API.Events.delete_event(event) do
|
with {:ok, _activity, event} <- API.Events.delete_event(event) do
|
||||||
{:ok, %{id: event.id}}
|
{:ok, %{id: event.id}}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,12 +7,11 @@ defmodule Mobilizon.GraphQL.Resolvers.Group do
|
||||||
alias Mobilizon.Actors.{Actor, Member}
|
alias Mobilizon.Actors.{Actor, Member}
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
|
alias Mobilizon.GraphQL.API
|
||||||
alias Mobilizon.GraphQL.Resolvers.Person
|
alias Mobilizon.GraphQL.Resolvers.Person
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub
|
alias Mobilizon.Federation.ActivityPub
|
||||||
|
|
||||||
alias MobilizonWeb.API
|
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -2,6 +2,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Member do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the member-related GraphQL calls
|
Handles the member-related GraphQL calls
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.{Actor}
|
alias Mobilizon.Actors.{Actor}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Picture do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the picture-related GraphQL calls
|
Handles the picture-related GraphQL calls
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Media
|
alias Mobilizon.Media
|
||||||
alias Mobilizon.Media.Picture
|
alias Mobilizon.Media.Picture
|
||||||
|
|
|
@ -11,7 +11,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Report do
|
||||||
alias Mobilizon.Reports.{Note, Report}
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
alias MobilizonWeb.API.Reports, as: ReportsAPI
|
alias Mobilizon.GraphQL.API
|
||||||
|
|
||||||
def list_reports(
|
def list_reports(
|
||||||
_parent,
|
_parent,
|
||||||
|
@ -50,7 +50,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Report do
|
||||||
%{context: %{current_user: user}} = _resolution
|
%{context: %{current_user: user}} = _resolution
|
||||||
) do
|
) do
|
||||||
with {:is_owned, %Actor{}} <- User.owns_actor(user, reporter_id),
|
with {:is_owned, %Actor{}} <- User.owns_actor(user, reporter_id),
|
||||||
{:ok, _, %Report{} = report} <- ReportsAPI.report(args) do
|
{:ok, _, %Report{} = report} <- API.Reports.report(args) do
|
||||||
{:ok, report}
|
{:ok, report}
|
||||||
else
|
else
|
||||||
{:is_owned, nil} ->
|
{:is_owned, nil} ->
|
||||||
|
@ -76,8 +76,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Report do
|
||||||
when is_moderator(role) do
|
when is_moderator(role) do
|
||||||
with {:is_owned, %Actor{} = actor} <- User.owns_actor(user, moderator_id),
|
with {:is_owned, %Actor{} = actor} <- User.owns_actor(user, moderator_id),
|
||||||
%Report{} = report <- Mobilizon.Reports.get_report(report_id),
|
%Report{} = report <- Mobilizon.Reports.get_report(report_id),
|
||||||
{:ok, %Report{} = report} <-
|
{:ok, %Report{} = report} <- API.Reports.update_report_status(actor, report, status) do
|
||||||
MobilizonWeb.API.Reports.update_report_status(actor, report, status) do
|
|
||||||
{:ok, report}
|
{:ok, report}
|
||||||
else
|
else
|
||||||
{:is_owned, nil} ->
|
{:is_owned, nil} ->
|
||||||
|
@ -101,8 +100,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Report do
|
||||||
with {:is_owned, %Actor{}} <- User.owns_actor(user, moderator_id),
|
with {:is_owned, %Actor{}} <- User.owns_actor(user, moderator_id),
|
||||||
%Report{} = report <- Reports.get_report(report_id),
|
%Report{} = report <- Reports.get_report(report_id),
|
||||||
%Actor{} = moderator <- Actors.get_local_actor_with_preload(moderator_id),
|
%Actor{} = moderator <- Actors.get_local_actor_with_preload(moderator_id),
|
||||||
{:ok, %Note{} = note} <-
|
{:ok, %Note{} = note} <- API.Reports.create_report_note(report, moderator, content) do
|
||||||
MobilizonWeb.API.Reports.create_report_note(report, moderator, content) do
|
|
||||||
{:ok, note}
|
{:ok, note}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -116,8 +114,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Report do
|
||||||
with {:is_owned, %Actor{}} <- User.owns_actor(user, moderator_id),
|
with {:is_owned, %Actor{}} <- User.owns_actor(user, moderator_id),
|
||||||
%Note{} = note <- Reports.get_note(note_id),
|
%Note{} = note <- Reports.get_note(note_id),
|
||||||
%Actor{} = moderator <- Actors.get_local_actor_with_preload(moderator_id),
|
%Actor{} = moderator <- Actors.get_local_actor_with_preload(moderator_id),
|
||||||
{:ok, %Note{} = note} <-
|
{:ok, %Note{} = note} <- API.Reports.delete_report_note(note, moderator) do
|
||||||
MobilizonWeb.API.Reports.delete_report_note(note, moderator) do
|
|
||||||
{:ok, %{id: note.id}}
|
{:ok, %{id: note.id}}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Search do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the event-related GraphQL calls
|
Handles the event-related GraphQL calls
|
||||||
"""
|
"""
|
||||||
alias MobilizonWeb.API.Search
|
|
||||||
|
alias Mobilizon.GraphQL.API.Search
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Search persons
|
Search persons
|
||||||
|
|
|
@ -2,6 +2,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Tag do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the tag-related GraphQL calls
|
Handles the tag-related GraphQL calls
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.{Event, Tag}
|
alias Mobilizon.Events.{Event, Tag}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,12 @@ defmodule Mix.Tasks.Mobilizon.MoveParticipantStats do
|
||||||
|
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
alias Mobilizon.Storage.Repo
|
import Ecto.Query
|
||||||
|
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Events.ParticipantRole
|
alias Mobilizon.Events.ParticipantRole
|
||||||
import Ecto.Query
|
alias Mobilizon.Storage.Repo
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ defmodule Mix.Tasks.Mobilizon.Relay do
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
alias Mix.Tasks.Mobilizon.Common
|
alias Mix.Tasks.Mobilizon.Common
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub.Relay
|
alias Mobilizon.Federation.ActivityPub.Relay
|
||||||
|
|
||||||
@shortdoc "Manages remote relays"
|
@shortdoc "Manages remote relays"
|
||||||
|
|
|
@ -5,10 +5,11 @@ defmodule Mix.Tasks.Mobilizon.Toot do
|
||||||
|
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
alias MobilizonWeb.API.Comments
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
|
||||||
|
alias Mobilizon.GraphQL.API.Comments
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@shortdoc "Toot to an user"
|
@shortdoc "Toot to an user"
|
||||||
|
|
|
@ -20,7 +20,7 @@ defmodule Mobilizon.Federation.ActivityPub.TransmogrifierTest do
|
||||||
alias Mobilizon.Federation.ActivityPub.{Activity, Relay, Transmogrifier}
|
alias Mobilizon.Federation.ActivityPub.{Activity, Relay, Transmogrifier}
|
||||||
alias Mobilizon.Federation.ActivityStream.{Convertible}
|
alias Mobilizon.Federation.ActivityStream.{Convertible}
|
||||||
|
|
||||||
alias MobilizonWeb.API
|
alias Mobilizon.GraphQL.API
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
HTTPoison.start()
|
HTTPoison.start()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.ReportTest do
|
defmodule Mobilizon.GraphQL.API.ReportTest do
|
||||||
use Mobilizon.DataCase
|
use Mobilizon.DataCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
@ -9,9 +9,9 @@ defmodule MobilizonWeb.API.ReportTest do
|
||||||
alias Mobilizon.Users
|
alias Mobilizon.Users
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub.{Activity, Relay}
|
alias Mobilizon.GraphQL.API.Reports
|
||||||
|
|
||||||
alias MobilizonWeb.API.Reports
|
alias Mobilizon.Federation.ActivityPub.{Activity, Relay}
|
||||||
|
|
||||||
describe "reports" do
|
describe "reports" do
|
||||||
test "creates a report on a event" do
|
test "creates a report on a event" do
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule MobilizonWeb.API.SearchTest do
|
defmodule Mobilizon.GraphQL.API.SearchTest do
|
||||||
use ExUnit.Case, async: false
|
use ExUnit.Case, async: false
|
||||||
|
|
||||||
import Mock
|
import Mock
|
||||||
|
@ -9,9 +9,9 @@ defmodule MobilizonWeb.API.SearchTest do
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Storage.Page
|
alias Mobilizon.Storage.Page
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub
|
alias Mobilizon.GraphQL.API.Search
|
||||||
|
|
||||||
alias MobilizonWeb.API.Search
|
alias Mobilizon.Federation.ActivityPub
|
||||||
|
|
||||||
test "search an user by username" do
|
test "search an user by username" do
|
||||||
with_mock ActivityPub,
|
with_mock ActivityPub,
|
|
@ -10,8 +10,8 @@ defmodule Mobilizon.GraphQL.Resolvers.AdminTest do
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub.Relay
|
alias Mobilizon.Federation.ActivityPub.Relay
|
||||||
|
|
||||||
|
alias Mobilizon.GraphQL.API
|
||||||
alias Mobilizon.GraphQL.AbsintheHelpers
|
alias Mobilizon.GraphQL.AbsintheHelpers
|
||||||
alias MobilizonWeb.API
|
|
||||||
|
|
||||||
describe "Resolver: List the action logs" do
|
describe "Resolver: List the action logs" do
|
||||||
@note_content "This a note on a report"
|
@note_content "This a note on a report"
|
||||||
|
|
Loading…
Reference in a new issue