Fix code readability issues
This commit is contained in:
parent
20dfce5c83
commit
aed824f1aa
|
@ -4,7 +4,9 @@
|
||||||
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/mix/tasks/pleroma/common.ex
|
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/mix/tasks/pleroma/common.ex
|
||||||
|
|
||||||
defmodule Mix.Tasks.Mobilizon.Common do
|
defmodule Mix.Tasks.Mobilizon.Common do
|
||||||
@moduledoc "Common functions to be reused in mix tasks"
|
@moduledoc """
|
||||||
|
Common functions to be reused in mix tasks
|
||||||
|
"""
|
||||||
|
|
||||||
def get_option(options, opt, prompt, defval \\ nil, defname \\ nil) do
|
def get_option(options, opt, prompt, defval \\ nil, defname \\ nil) do
|
||||||
display = if defname || defval, do: "#{prompt} [#{defname || defval}]", else: "#{prompt}"
|
display = if defname || defval, do: "#{prompt} [#{defname || defval}]", else: "#{prompt}"
|
||||||
|
@ -13,17 +15,21 @@ defmodule Mix.Tasks.Mobilizon.Common do
|
||||||
case Mix.shell().prompt(display) do
|
case Mix.shell().prompt(display) do
|
||||||
"\n" ->
|
"\n" ->
|
||||||
case defval do
|
case defval do
|
||||||
nil -> get_option(options, opt, prompt, defval)
|
nil ->
|
||||||
defval -> defval
|
get_option(options, opt, prompt, defval)
|
||||||
|
|
||||||
|
defval ->
|
||||||
|
defval
|
||||||
end
|
end
|
||||||
|
|
||||||
opt ->
|
opt ->
|
||||||
opt |> String.trim()
|
String.trim(opt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_mobilizon do
|
def start_mobilizon do
|
||||||
Application.put_env(:phoenix, :serve_endpoints, false, persistent: true)
|
Application.put_env(:phoenix, :serve_endpoints, false, persistent: true)
|
||||||
|
|
||||||
{:ok, _} = Application.ensure_all_started(:mobilizon)
|
{:ok, _} = Application.ensure_all_started(:mobilizon)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
defmodule Mix.Tasks.Mobilizon.CreateBot do
|
defmodule Mix.Tasks.Mobilizon.CreateBot do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Creates a bot from a source
|
Creates a bot from a source.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Users
|
alias Mobilizon.{Actors, Users}
|
||||||
alias Mobilizon.Actors.Bot
|
alias Mobilizon.Actors.Bot
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@shortdoc "Register user"
|
@shortdoc "Register user"
|
||||||
|
@ -25,7 +26,8 @@ defmodule Mix.Tasks.Mobilizon.CreateBot do
|
||||||
}) do
|
}) do
|
||||||
bot
|
bot
|
||||||
else
|
else
|
||||||
e -> Logger.error(inspect(e))
|
error ->
|
||||||
|
Logger.error(inspect(error))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,11 +4,6 @@
|
||||||
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/mix/tasks/pleroma/instance.ex
|
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/mix/tasks/pleroma/instance.ex
|
||||||
|
|
||||||
defmodule Mix.Tasks.Mobilizon.Instance do
|
defmodule Mix.Tasks.Mobilizon.Instance do
|
||||||
use Mix.Task
|
|
||||||
alias Mix.Tasks.Mobilizon.Common
|
|
||||||
|
|
||||||
@shortdoc "Generates a new config"
|
|
||||||
@preferred_cli_env "prod"
|
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Generates a new config
|
Generates a new config
|
||||||
|
|
||||||
|
@ -31,6 +26,13 @@ defmodule Mix.Tasks.Mobilizon.Instance do
|
||||||
- `--dbpass DBPASS` - the password to use for the database connection
|
- `--dbpass DBPASS` - the password to use for the database connection
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
use Mix.Task
|
||||||
|
|
||||||
|
alias Mix.Tasks.Mobilizon.Common
|
||||||
|
|
||||||
|
@preferred_cli_env "prod"
|
||||||
|
|
||||||
|
@shortdoc "Generates a new config"
|
||||||
def run(["gen" | options]) do
|
def run(["gen" | options]) do
|
||||||
{options, [], []} =
|
{options, [], []} =
|
||||||
OptionParser.parse(
|
OptionParser.parse(
|
||||||
|
|
|
@ -4,11 +4,6 @@
|
||||||
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/mix/tasks/pleroma/relay.ex
|
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/mix/tasks/pleroma/relay.ex
|
||||||
|
|
||||||
defmodule Mix.Tasks.Mobilizon.Relay do
|
defmodule Mix.Tasks.Mobilizon.Relay do
|
||||||
use Mix.Task
|
|
||||||
alias Mobilizon.Service.ActivityPub.Relay
|
|
||||||
alias Mix.Tasks.Mobilizon.Common
|
|
||||||
|
|
||||||
@shortdoc "Manages remote relays"
|
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Manages remote relays
|
Manages remote relays
|
||||||
|
|
||||||
|
@ -24,6 +19,13 @@ defmodule Mix.Tasks.Mobilizon.Relay do
|
||||||
|
|
||||||
Example: ``mix mobilizon.relay unfollow https://example.org/relay``
|
Example: ``mix mobilizon.relay unfollow https://example.org/relay``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
use Mix.Task
|
||||||
|
|
||||||
|
alias Mix.Tasks.Mobilizon.Common
|
||||||
|
alias Mobilizon.Service.ActivityPub.Relay
|
||||||
|
|
||||||
|
@shortdoc "Manages remote relays"
|
||||||
def run(["follow", target]) do
|
def run(["follow", target]) do
|
||||||
Common.start_mobilizon()
|
Common.start_mobilizon()
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
defmodule Mix.Tasks.Mobilizon.Toot do
|
defmodule Mix.Tasks.Mobilizon.Toot do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Creates a bot from a source
|
Creates a bot from a source.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@shortdoc "Toot to an user"
|
@shortdoc "Toot to an user"
|
||||||
|
|
|
@ -11,11 +11,11 @@ defmodule Mobilizon.Actors.Actor do
|
||||||
alias Mobilizon.Actors.{ActorOpenness, ActorType, ActorVisibility, Follower, Member}
|
alias Mobilizon.Actors.{ActorOpenness, ActorType, ActorVisibility, Follower, Member}
|
||||||
alias Mobilizon.Events.{Event, FeedToken}
|
alias Mobilizon.Events.{Event, FeedToken}
|
||||||
alias Mobilizon.Media.File
|
alias Mobilizon.Media.File
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
|
||||||
alias MobilizonWeb.Endpoint
|
alias MobilizonWeb.Endpoint
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ defmodule Mobilizon.Events.Comment do
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events.{Comment, CommentVisibility, Event}
|
alias Mobilizon.Events.{Comment, CommentVisibility, Event}
|
||||||
|
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
|
||||||
alias MobilizonWeb.Endpoint
|
alias MobilizonWeb.Endpoint
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
text: String.t(),
|
text: String.t(),
|
||||||
|
|
|
@ -16,8 +16,8 @@ defmodule Mobilizon.Events.Event do
|
||||||
EventVisibility,
|
EventVisibility,
|
||||||
JoinOptions,
|
JoinOptions,
|
||||||
Participant,
|
Participant,
|
||||||
Tag,
|
|
||||||
Session,
|
Session,
|
||||||
|
Tag,
|
||||||
Track
|
Track
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ defmodule Mobilizon.Events.EventOptions do
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
alias Mobilizon.Events.{
|
alias Mobilizon.Events.{
|
||||||
|
CommentModeration,
|
||||||
EventOffer,
|
EventOffer,
|
||||||
EventParticipationCondition,
|
EventParticipationCondition
|
||||||
CommentModeration
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
|
|
|
@ -7,8 +7,8 @@ defmodule Mobilizon.Events.Tag do
|
||||||
|
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
alias Mobilizon.Events.TagRelation
|
|
||||||
alias Mobilizon.Events.Tag.TitleSlug
|
alias Mobilizon.Events.Tag.TitleSlug
|
||||||
|
alias Mobilizon.Events.TagRelation
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
title: String.t(),
|
title: String.t(),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
defmodule MobilizonWeb.API.Comments do
|
defmodule MobilizonWeb.API.Comments do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Comments
|
API for Comments.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
|
@ -8,6 +8,7 @@ defmodule MobilizonWeb.API.Comments do
|
||||||
alias Mobilizon.Events.Comment
|
alias Mobilizon.Events.Comment
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils
|
alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils
|
||||||
|
|
||||||
alias MobilizonWeb.API.Utils
|
alias MobilizonWeb.API.Utils
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule MobilizonWeb.API.Events do
|
defmodule MobilizonWeb.API.Events do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Events
|
API for Events.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils
|
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
alias Mobilizon.Service.ActivityPub.Activity
|
||||||
|
alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils
|
||||||
|
|
||||||
alias MobilizonWeb.API.Utils
|
alias MobilizonWeb.API.Utils
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -6,6 +6,7 @@ defmodule MobilizonWeb.API.Follows do
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.{Actor, Follower}
|
alias Mobilizon.Actors.{Actor, Follower}
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
def follow(%Actor{} = follower, %Actor{} = followed) do
|
def follow(%Actor{} = follower, %Actor{} = followed) do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule MobilizonWeb.API.Groups do
|
defmodule MobilizonWeb.API.Groups do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Events
|
API for Groups.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils
|
alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
alias MobilizonWeb.API.Utils
|
alias MobilizonWeb.API.Utils
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
defmodule MobilizonWeb.API.Participations do
|
defmodule MobilizonWeb.API.Participations do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Common API to join events and groups
|
Common API to join events and groups.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
defmodule MobilizonWeb.API.Reports do
|
defmodule MobilizonWeb.API.Reports do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
API for Reports
|
API for Reports.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import MobilizonWeb.API.Utils
|
|
||||||
import Mobilizon.Service.Admin.ActionLogService
|
import Mobilizon.Service.Admin.ActionLogService
|
||||||
|
|
||||||
|
import MobilizonWeb.API.Utils
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
|
||||||
alias Mobilizon.Reports, as: ReportsAction
|
alias Mobilizon.Reports, as: ReportsAction
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
|
alias Mobilizon.Service.ActivityPub.Activity
|
||||||
alias Mobilizon.Users
|
alias Mobilizon.Users
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
defmodule MobilizonWeb.API.Utils do
|
defmodule MobilizonWeb.API.Utils do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Utils for API
|
Utils for API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
|
|
@ -8,8 +8,8 @@ defmodule MobilizonWeb.MediaProxyController do
|
||||||
|
|
||||||
alias Mobilizon.Config
|
alias Mobilizon.Config
|
||||||
|
|
||||||
alias MobilizonWeb.ReverseProxy
|
|
||||||
alias MobilizonWeb.MediaProxy
|
alias MobilizonWeb.MediaProxy
|
||||||
|
alias MobilizonWeb.ReverseProxy
|
||||||
|
|
||||||
@default_proxy_opts [max_body_length: 25 * 1_048_576, http: [follow_redirect: true]]
|
@default_proxy_opts [max_body_length: 25 * 1_048_576, http: [follow_redirect: true]]
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
defmodule MobilizonWeb.Resolvers.Admin do
|
defmodule MobilizonWeb.Resolvers.Admin do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the report-related GraphQL calls
|
Handles the report-related GraphQL calls.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Events
|
|
||||||
alias Mobilizon.Users.User
|
|
||||||
import Mobilizon.Users.Guards
|
import Mobilizon.Users.Guards
|
||||||
|
|
||||||
alias Mobilizon.Admin.ActionLog
|
alias Mobilizon.Admin.ActionLog
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
alias Mobilizon.Service.Statistics
|
alias Mobilizon.Service.Statistics
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
def list_action_logs(
|
def list_action_logs(
|
||||||
_parent,
|
_parent,
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
defmodule MobilizonWeb.Resolvers.Comment do
|
defmodule MobilizonWeb.Resolvers.Comment do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the comment-related GraphQL calls
|
Handles the comment-related GraphQL calls.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Events.Comment
|
alias Mobilizon.Events.Comment
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
alias Mobilizon.Service.ActivityPub.Activity
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
alias MobilizonWeb.API.Comments
|
alias MobilizonWeb.API.Comments
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
defmodule MobilizonWeb.Resolvers.Event do
|
defmodule MobilizonWeb.Resolvers.Event do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the event-related GraphQL calls
|
Handles the event-related GraphQL calls.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import Mobilizon.Service.Admin.ActionLogService
|
||||||
|
|
||||||
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Addresses
|
alias Mobilizon.Addresses
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.{Event, Participant}
|
alias Mobilizon.Events.{Event, Participant}
|
||||||
alias Mobilizon.Media.Picture
|
alias Mobilizon.Media.Picture
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
alias MobilizonWeb.Resolvers.Person
|
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
alias Mobilizon.Service.ActivityPub.Activity
|
||||||
import Mobilizon.Service.Admin.ActionLogService
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
|
alias MobilizonWeb.Resolvers.Person
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
defmodule MobilizonWeb.Resolvers.FeedToken do
|
defmodule MobilizonWeb.Resolvers.FeedToken do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the feed tokens-related GraphQL calls
|
Handles the feed tokens-related GraphQL calls.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.FeedToken
|
alias Mobilizon.Events.FeedToken
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
defmodule MobilizonWeb.Resolvers.Group do
|
defmodule MobilizonWeb.Resolvers.Group do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the group-related GraphQL calls
|
Handles the group-related GraphQL calls.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.{Actor, Member}
|
alias Mobilizon.Actors.{Actor, Member}
|
||||||
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
alias Mobilizon.Service.ActivityPub.Activity
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
alias Mobilizon.Service.ActivityPub
|
|
||||||
|
|
||||||
alias MobilizonWeb.Resolvers.Person
|
alias MobilizonWeb.Resolvers.Person
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
defmodule MobilizonWeb.Resolvers.Report do
|
defmodule MobilizonWeb.Resolvers.Report do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the report-related GraphQL calls
|
Handles the report-related GraphQL calls.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Reports
|
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias MobilizonWeb.API.Reports, as: ReportsAPI
|
|
||||||
import Mobilizon.Users.Guards
|
import Mobilizon.Users.Guards
|
||||||
|
|
||||||
|
alias Mobilizon.Actors
|
||||||
|
alias Mobilizon.Actors.Actor
|
||||||
|
alias Mobilizon.Reports
|
||||||
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
|
alias MobilizonWeb.API.Reports, as: ReportsAPI
|
||||||
|
|
||||||
def list_reports(
|
def list_reports(
|
||||||
_parent,
|
_parent,
|
||||||
%{page: page, limit: limit, status: status},
|
%{page: page, limit: limit, status: status},
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
defmodule MobilizonWeb.Resolvers.User do
|
defmodule MobilizonWeb.Resolvers.User do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the user-related GraphQL calls
|
Handles the user-related GraphQL calls.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import Mobilizon.Users.Guards
|
||||||
|
|
||||||
alias Mobilizon.{Actors, Config, Users, Events}
|
alias Mobilizon.{Actors, Config, Users, Events}
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.Users.{ResetPassword, Activation}
|
alias Mobilizon.Service.Users.{Activation, ResetPassword}
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
alias Mobilizon.Storage.Repo
|
alias Mobilizon.Storage.Repo
|
||||||
|
|
||||||
import Mobilizon.Users.Guards
|
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
defmodule MobilizonWeb.Schema do
|
defmodule MobilizonWeb.Schema do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
GraphQL schema representation
|
GraphQL schema representation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Absinthe.Schema
|
use Absinthe.Schema
|
||||||
|
|
||||||
alias Mobilizon.{Actors, Events, Users, Addresses, Media, Reports}
|
alias Mobilizon.{Actors, Addresses, Events, Media, Reports, Users}
|
||||||
alias Mobilizon.Actors.{Actor, Follower, Member}
|
alias Mobilizon.Actors.{Actor, Follower, Member}
|
||||||
alias Mobilizon.Events.{Event, Comment, Participant}
|
alias Mobilizon.Events.{Comment, Event, Participant}
|
||||||
alias Mobilizon.Storage.Repo
|
alias Mobilizon.Storage.Repo
|
||||||
|
|
||||||
import_types(MobilizonWeb.Schema.Custom.UUID)
|
import_types(MobilizonWeb.Schema.Custom.UUID)
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
defmodule MobilizonWeb.Schema.Actors.GroupType do
|
defmodule MobilizonWeb.Schema.Actors.GroupType do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Schema representation for Group
|
Schema representation for Group.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Absinthe.Schema.Notation
|
use Absinthe.Schema.Notation
|
||||||
|
|
||||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||||
import_types(MobilizonWeb.Schema.Actors.MemberType)
|
|
||||||
alias MobilizonWeb.Resolvers.{Member, Group}
|
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
|
|
||||||
|
alias MobilizonWeb.Resolvers.{Group, Member}
|
||||||
|
|
||||||
|
import_types(MobilizonWeb.Schema.Actors.MemberType)
|
||||||
|
|
||||||
@desc """
|
@desc """
|
||||||
Represents a group of actors
|
Represents a group of actors
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
defmodule MobilizonWeb.Schema.AdminType do
|
defmodule MobilizonWeb.Schema.AdminType do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Schema representation for ActionLog
|
Schema representation for ActionLog.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Absinthe.Schema.Notation
|
use Absinthe.Schema.Notation
|
||||||
alias MobilizonWeb.Resolvers.Admin
|
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
|
|
||||||
|
alias MobilizonWeb.Resolvers.Admin
|
||||||
|
|
||||||
@desc "An action log"
|
@desc "An action log"
|
||||||
object :action_log do
|
object :action_log do
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
defmodule MobilizonWeb.Schema.EventType do
|
defmodule MobilizonWeb.Schema.EventType do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Schema representation for Event
|
Schema representation for Event.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Absinthe.Schema.Notation
|
use Absinthe.Schema.Notation
|
||||||
alias Mobilizon.{Actors, Addresses}
|
|
||||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||||
|
|
||||||
|
alias Mobilizon.{Actors, Addresses}
|
||||||
|
|
||||||
|
alias MobilizonWeb.Resolvers.{Event, Picture, Tag}
|
||||||
|
|
||||||
import_types(MobilizonWeb.Schema.AddressType)
|
import_types(MobilizonWeb.Schema.AddressType)
|
||||||
import_types(MobilizonWeb.Schema.Events.ParticipantType)
|
import_types(MobilizonWeb.Schema.Events.ParticipantType)
|
||||||
import_types(MobilizonWeb.Schema.TagType)
|
import_types(MobilizonWeb.Schema.TagType)
|
||||||
alias MobilizonWeb.Resolvers.{Picture, Event, Tag}
|
|
||||||
|
|
||||||
@desc "An event"
|
@desc "An event"
|
||||||
object :event do
|
object :event do
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
defmodule MobilizonWeb.Schema.Events.FeedTokenType do
|
defmodule MobilizonWeb.Schema.Events.FeedTokenType do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Schema representation for Participant
|
Schema representation for Participant.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Absinthe.Schema.Notation
|
use Absinthe.Schema.Notation
|
||||||
|
|
||||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||||
|
|
||||||
|
alias Mobilizon.{Actors, Users}
|
||||||
|
|
||||||
alias MobilizonWeb.Resolvers
|
alias MobilizonWeb.Resolvers
|
||||||
alias Mobilizon.Users
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
|
|
||||||
@desc "Represents a participant to an event"
|
@desc "Represents a participant to an event"
|
||||||
object :feed_token do
|
object :feed_token do
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
defmodule MobilizonWeb.Schema.Events.ParticipantType do
|
defmodule MobilizonWeb.Schema.Events.ParticipantType do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Schema representation for Participant
|
Schema representation for Participant.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Absinthe.Schema.Notation
|
use Absinthe.Schema.Notation
|
||||||
|
|
||||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||||
|
|
||||||
|
alias Mobilizon.{Actors, Events}
|
||||||
|
|
||||||
alias MobilizonWeb.Resolvers
|
alias MobilizonWeb.Resolvers
|
||||||
alias Mobilizon.Events
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
|
|
||||||
@desc "Represents a participant to an event"
|
@desc "Represents a participant to an event"
|
||||||
object :participant do
|
object :participant do
|
||||||
|
|
|
@ -3,9 +3,8 @@ defmodule MobilizonWeb.ActivityPub.ActorView do
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Service.ActivityPub.Utils
|
alias Mobilizon.Service.ActivityPub.{Activity, Utils}
|
||||||
|
|
||||||
@private_visibility_empty_collection %{elements: [], total: 0}
|
@private_visibility_empty_collection %{elements: [], total: 0}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
defmodule MobilizonWeb.JsonLD.ObjectView do
|
defmodule MobilizonWeb.JsonLD.ObjectView do
|
||||||
use MobilizonWeb, :view
|
use MobilizonWeb, :view
|
||||||
|
|
||||||
alias Mobilizon.Events.Event
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Events.Event
|
||||||
|
|
||||||
alias MobilizonWeb.JsonLD.ObjectView
|
alias MobilizonWeb.JsonLD.ObjectView
|
||||||
alias MobilizonWeb.MediaProxy
|
alias MobilizonWeb.MediaProxy
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ defmodule MobilizonWeb.PageView do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp index_file_path() do
|
defp index_file_path do
|
||||||
Path.join(Application.app_dir(:mobilizon, "priv/static"), "index.html")
|
Path.join(Application.app_dir(:mobilizon, "priv/static"), "index.html")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,28 +5,19 @@
|
||||||
|
|
||||||
defmodule Mobilizon.Service.ActivityPub do
|
defmodule Mobilizon.Service.ActivityPub do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
# ActivityPub
|
# ActivityPub context.
|
||||||
|
|
||||||
Every ActivityPub method
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Config
|
import Mobilizon.Service.ActivityPub.{Utils, Visibility}
|
||||||
alias Mobilizon.Events
|
|
||||||
alias Mobilizon.Events.{Event, Comment, Participant}
|
|
||||||
alias Mobilizon.Service.ActivityPub.Transmogrifier
|
|
||||||
alias Mobilizon.Service.WebFinger
|
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.{Actors, Config, Events}
|
||||||
alias Mobilizon.Actors.{Actor, Follower}
|
alias Mobilizon.Actors.{Actor, Follower}
|
||||||
|
alias Mobilizon.Events.{Comment, Event, Participant}
|
||||||
alias Mobilizon.Service.Federator
|
alias Mobilizon.Service.ActivityPub.{Activity, Convertible, Transmogrifier}
|
||||||
|
alias Mobilizon.Service.{Federator, WebFinger}
|
||||||
alias Mobilizon.Service.HTTPSignatures.Signature
|
alias Mobilizon.Service.HTTPSignatures.Signature
|
||||||
|
|
||||||
alias Mobilizon.Service.ActivityPub.{Activity, Convertible}
|
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
import Mobilizon.Service.ActivityPub.Utils
|
|
||||||
import Mobilizon.Service.ActivityPub.Visibility
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Get recipients for an activity or object
|
Get recipients for an activity or object
|
||||||
|
@ -452,7 +443,8 @@ defmodule Mobilizon.Service.ActivityPub do
|
||||||
|
|
||||||
def leave(object, actor, local \\ true)
|
def leave(object, actor, local \\ true)
|
||||||
|
|
||||||
# TODO: If we want to use this for exclusion we need to have an extra field for the actor that excluded the participant
|
# TODO: If we want to use this for exclusion we need to have an extra field
|
||||||
|
# for the actor that excluded the participant
|
||||||
def leave(
|
def leave(
|
||||||
%Event{id: event_id, url: event_url} = event,
|
%Event{id: event_id, url: event_url} = event,
|
||||||
%Actor{id: actor_id, url: actor_url} = _actor,
|
%Actor{id: actor_id, url: actor_url} = _actor,
|
||||||
|
|
|
@ -2,8 +2,10 @@ defmodule Mobilizon.Service.ActivityPub.Converters.Actor do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Actor converter
|
Actor converter
|
||||||
|
|
||||||
This module allows to convert events from ActivityStream format to our own internal one, and back
|
This module allows to convert events from ActivityStream format to our own
|
||||||
|
internal one, and back.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor, as: ActorModel
|
alias Mobilizon.Actors.Actor, as: ActorModel
|
||||||
alias Mobilizon.Service.ActivityPub.Converter
|
alias Mobilizon.Service.ActivityPub.Converter
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
defmodule Mobilizon.Service.ActivityPub.Converters.Address do
|
defmodule Mobilizon.Service.ActivityPub.Converters.Address do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Flag converter
|
Address converter.
|
||||||
|
|
||||||
This module allows to convert reports from ActivityStream format to our own internal one, and back.
|
This module allows to convert reports from ActivityStream format to our own
|
||||||
|
internal one, and back.
|
||||||
|
|
||||||
Note: Reports are named Flag in AS.
|
Note: Reports are named Flag in AS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Addresses.Address, as: AddressModel
|
alias Mobilizon.Addresses.Address, as: AddressModel
|
||||||
alias Mobilizon.Service.ActivityPub.Converter
|
alias Mobilizon.Service.ActivityPub.Converter
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
defmodule Mobilizon.Service.ActivityPub.Converters.Comment do
|
defmodule Mobilizon.Service.ActivityPub.Converters.Comment do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Comment converter
|
Comment converter.
|
||||||
|
|
||||||
This module allows to convert events from ActivityStream format to our own internal one, and back
|
This module allows to convert events from ActivityStream format to our own
|
||||||
|
internal one, and back.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events.Comment, as: CommentModel
|
alias Mobilizon.Events.Comment, as: CommentModel
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Service.ActivityPub.Converter
|
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
|
alias Mobilizon.Service.ActivityPub.Converter
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@behaviour Converter
|
@behaviour Converter
|
||||||
|
|
|
@ -1,26 +1,24 @@
|
||||||
defmodule Mobilizon.Service.ActivityPub.Converters.Event do
|
defmodule Mobilizon.Service.ActivityPub.Converters.Event do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Event converter
|
Event converter.
|
||||||
|
|
||||||
This module allows to convert events from ActivityStream format to our own internal one, and back
|
This module allows to convert events from ActivityStream format to our own
|
||||||
|
internal one, and back.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Media
|
|
||||||
alias Mobilizon.Media.Picture
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
alias Mobilizon.Events.Event, as: EventModel
|
|
||||||
alias Mobilizon.Service.ActivityPub.Converter
|
|
||||||
alias Mobilizon.Service.ActivityPub.Converters.Address, as: AddressConverter
|
|
||||||
alias Mobilizon.Service.ActivityPub.Utils
|
|
||||||
alias Mobilizon.Events
|
|
||||||
alias Mobilizon.Events.Tag
|
|
||||||
alias Mobilizon.Addresses
|
|
||||||
alias Mobilizon.Addresses.Address
|
|
||||||
|
|
||||||
@behaviour Converter
|
alias Mobilizon.{Actors, Addresses, Events, Media}
|
||||||
|
alias Mobilizon.Actors.Actor
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Events.Event, as: EventModel
|
||||||
|
alias Mobilizon.Events.Tag
|
||||||
|
alias Mobilizon.Media.Picture
|
||||||
|
alias Mobilizon.Service.ActivityPub.{Converter, Utils}
|
||||||
|
alias Mobilizon.Service.ActivityPub.Converters.Address, as: AddressConverter
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
@behaviour Converter
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Converts an AP object data to our internal data structure
|
Converts an AP object data to our internal data structure
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
defmodule Mobilizon.Service.ActivityPub.Converters.Flag do
|
defmodule Mobilizon.Service.ActivityPub.Converters.Flag do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Flag converter
|
Flag converter.
|
||||||
|
|
||||||
This module allows to convert reports from ActivityStream format to our own internal one, and back.
|
This module allows to convert reports from ActivityStream format to our own
|
||||||
|
internal one, and back.
|
||||||
|
|
||||||
Note: Reports are named Flag in AS.
|
Note: Reports are named Flag in AS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
defmodule Mobilizon.Service.ActivityPub.Converters.Participant do
|
defmodule Mobilizon.Service.ActivityPub.Converters.Participant do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Flag converter
|
Participant converter.
|
||||||
|
|
||||||
This module allows to convert reports from ActivityStream format to our own internal one, and back.
|
This module allows to convert reports from ActivityStream format to our own
|
||||||
|
internal one, and back.
|
||||||
|
|
||||||
Note: Reports are named Flag in AS.
|
Note: Reports are named Flag in AS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Events.Participant, as: ParticipantModel
|
alias Mobilizon.Events.Participant, as: ParticipantModel
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
defmodule Mobilizon.Service.ActivityPub.Relay do
|
defmodule Mobilizon.Service.ActivityPub.Relay do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles following and unfollowing relays and instances
|
Handles following and unfollowing relays and instances.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
|
alias Mobilizon.Service.ActivityPub.Activity
|
||||||
|
|
||||||
alias MobilizonWeb.API.Follows
|
alias MobilizonWeb.API.Follows
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,13 @@ defmodule Mobilizon.Service.ActivityPub.Transmogrifier do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
A module to handle coding from internal to wire ActivityPub and back.
|
A module to handle coding from internal to wire ActivityPub and back.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.{Actor, Follower}
|
alias Mobilizon.Actors.{Actor, Follower}
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.{Event, Comment, Participant}
|
alias Mobilizon.Events.{Comment, Event, Participant}
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Service.ActivityPub.{Visibility, Utils}
|
alias Mobilizon.Service.ActivityPub.{Utils, Visibility}
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,19 @@
|
||||||
|
|
||||||
defmodule Mobilizon.Service.ActivityPub.Utils do
|
defmodule Mobilizon.Service.ActivityPub.Utils do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
# Utils
|
# Various ActivityPub related utils.
|
||||||
|
|
||||||
Various utils
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Ecto.Changeset
|
alias Ecto.Changeset
|
||||||
|
|
||||||
alias Mobilizon.Addresses
|
alias Mobilizon.{Actors, Addresses, Events, Reports, Users}
|
||||||
alias Mobilizon.Addresses.Address
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Addresses.Address
|
||||||
alias Mobilizon.Events.{Comment, Event}
|
alias Mobilizon.Events.{Comment, Event}
|
||||||
alias Mobilizon.Media.Picture
|
alias Mobilizon.Media.Picture
|
||||||
alias Mobilizon.Reports
|
|
||||||
alias Mobilizon.Reports.Report
|
alias Mobilizon.Reports.Report
|
||||||
alias Mobilizon.Service.ActivityPub.{Activity, Converters}
|
alias Mobilizon.Service.ActivityPub.{Activity, Converters}
|
||||||
alias Mobilizon.Storage.Repo
|
alias Mobilizon.Storage.Repo
|
||||||
alias Mobilizon.Users
|
|
||||||
|
|
||||||
alias MobilizonWeb.{Email, Endpoint}
|
alias MobilizonWeb.{Email, Endpoint}
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
defmodule Mobilizon.Service.Admin.ActionLogService do
|
defmodule Mobilizon.Service.Admin.ActionLogService do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Module to handle action log creations
|
Module to handle action log creations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Users
|
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Admin
|
alias Mobilizon.Admin
|
||||||
alias Mobilizon.Admin.ActionLog
|
alias Mobilizon.Admin.ActionLog
|
||||||
|
alias Mobilizon.Users
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Log an admin action
|
Log an admin action
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
defmodule Mobilizon.Service.EmailChecker do
|
defmodule Mobilizon.Service.EmailChecker do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Provides a function to test emails against a "not so bad" regex
|
Provides a function to test emails against a "not so bad" regex.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# TODO: simplify me!
|
||||||
@email_regex ~r/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
@email_regex ~r/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns whether the email is valid
|
Returns whether the email is valid.
|
||||||
"""
|
"""
|
||||||
@spec valid?(String.t()) :: boolean()
|
@spec valid?(String.t()) :: boolean
|
||||||
def valid?(email) do
|
def valid?(email), do: email =~ @email_regex
|
||||||
email =~ @email_regex
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
defmodule Mobilizon.Service.Export.Feed do
|
defmodule Mobilizon.Service.Export.Feed do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Serve Atom Syndication Feeds
|
Serve Atom Syndication Feeds.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Users
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
alias Mobilizon.Events
|
|
||||||
alias Mobilizon.Events.{Event, FeedToken}
|
|
||||||
alias Atomex.{Feed, Entry}
|
|
||||||
import MobilizonWeb.Gettext
|
import MobilizonWeb.Gettext
|
||||||
|
|
||||||
|
alias Atomex.{Entry, Feed}
|
||||||
|
|
||||||
|
alias Mobilizon.{Actors, Events, Users}
|
||||||
|
alias Mobilizon.Actors.Actor
|
||||||
|
alias Mobilizon.Events.{Event, FeedToken}
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
|
alias MobilizonWeb.{Endpoint, MediaProxy}
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
alias MobilizonWeb.Endpoint
|
|
||||||
alias MobilizonWeb.MediaProxy
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@version Mix.Project.config()[:version]
|
@version Mix.Project.config()[:version]
|
||||||
def version(), do: @version
|
def version, do: @version
|
||||||
|
|
||||||
@spec create_cache(String.t()) :: {:commit, String.t()} | {:ignore, any()}
|
@spec create_cache(String.t()) :: {:commit, String.t()} | {:ignore, any()}
|
||||||
def create_cache("actor_" <> name) do
|
def create_cache("actor_" <> name) do
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
defmodule Mobilizon.Service.Export.ICalendar do
|
defmodule Mobilizon.Service.Export.ICalendar do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Export an event to iCalendar format
|
Export an event to iCalendar format.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Events.{Event, FeedToken}
|
alias Mobilizon.{Actors, Events, Users}
|
||||||
alias Mobilizon.Events
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Events.{Event, FeedToken}
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
alias Mobilizon.Users
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Export a public event to iCalendar format.
|
Export a public event to iCalendar format.
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
|
|
||||||
defmodule Mobilizon.Service.Formatter do
|
defmodule Mobilizon.Service.Formatter do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Formats input text to structured data, extracts mentions and hashtags
|
Formats input text to structured data, extracts mentions and hashtags.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.HTML
|
alias Mobilizon.Service.HTML
|
||||||
|
|
||||||
@link_regex ~r"((?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~%:/?#[\]@!\$&'\(\)\*\+,;=.]+)|[0-9a-z+\-\.]+:[0-9a-z$-_.+!*'(),]+"ui
|
@link_regex ~r"((?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~%:/?#[\]@!\$&'\(\)\*\+,;=.]+)|[0-9a-z+\-\.]+:[0-9a-z$-_.+!*'(),]+"ui
|
||||||
|
|
|
@ -2,9 +2,11 @@ defmodule Mobilizon.Service.Geospatial.Addok do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
[Addok](https://github.com/addok/addok) backend.
|
[Addok](https://github.com/addok/addok) backend.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Service.Geospatial.Provider
|
|
||||||
require Logger
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Provider
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
defmodule Mobilizon.Service.Geospatial do
|
defmodule Mobilizon.Service.Geospatial do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Module to load the service adapter defined inside the configuration
|
Module to load the service adapter defined inside the configuration.
|
||||||
|
|
||||||
See `Mobilizon.Service.Geospatial.Provider`
|
See `Mobilizon.Service.Geospatial.Provider`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the appropriate service adapter
|
Returns the appropriate service adapter.
|
||||||
|
|
||||||
According to the config behind `config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Module`
|
According to the config behind
|
||||||
|
`config :mobilizon, Mobilizon.Service.Geospatial,
|
||||||
|
service: Mobilizon.Service.Geospatial.Module`
|
||||||
"""
|
"""
|
||||||
@spec service() :: module()
|
@spec service :: module
|
||||||
def service(), do: Application.get_env(:mobilizon, __MODULE__) |> get_in([:service])
|
def service, do: get_in(Application.get_env(:mobilizon, __MODULE__), [:service])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
defmodule Mobilizon.Service.Geospatial.GoogleMaps do
|
defmodule Mobilizon.Service.Geospatial.GoogleMaps do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Google Maps [Geocoding service](https://developers.google.com/maps/documentation/geocoding/intro)
|
Google Maps [Geocoding service](https://developers.google.com/maps/documentation/geocoding/intro).
|
||||||
|
|
||||||
Note: Endpoint is hardcoded to Google Maps API
|
Note: Endpoint is hardcoded to Google Maps API.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Service.Geospatial.Provider
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Provider
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
|
|
@ -8,8 +8,10 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do
|
||||||
* `:open_data` Whether to use [Open Data or Licenced Data](https://developer.mapquest.com/documentation/open/).
|
* `:open_data` Whether to use [Open Data or Licenced Data](https://developer.mapquest.com/documentation/open/).
|
||||||
Defaults to `true`
|
Defaults to `true`
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Service.Geospatial.Provider
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Provider
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
|
|
@ -2,8 +2,10 @@ defmodule Mobilizon.Service.Geospatial.Nominatim do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) backend.
|
[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) backend.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Service.Geospatial.Provider
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Provider
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
@ -66,23 +68,22 @@ defmodule Mobilizon.Service.Geospatial.Nominatim do
|
||||||
|
|
||||||
@spec process_data(map()) :: Address.t()
|
@spec process_data(map()) :: Address.t()
|
||||||
defp process_data(%{"address" => address} = body) do
|
defp process_data(%{"address" => address} = body) do
|
||||||
try do
|
%Address{
|
||||||
%Address{
|
country: Map.get(address, "country"),
|
||||||
country: Map.get(address, "country"),
|
locality: Map.get(address, "city"),
|
||||||
locality: Map.get(address, "city"),
|
region: Map.get(address, "state"),
|
||||||
region: Map.get(address, "state"),
|
description: description(body),
|
||||||
description: description(body),
|
floor: Map.get(address, "floor"),
|
||||||
floor: Map.get(address, "floor"),
|
geom: [Map.get(body, "lon"), Map.get(body, "lat")] |> Provider.coordinates(),
|
||||||
geom: [Map.get(body, "lon"), Map.get(body, "lat")] |> Provider.coordinates(),
|
postal_code: Map.get(address, "postcode"),
|
||||||
postal_code: Map.get(address, "postcode"),
|
street: street_address(address),
|
||||||
street: street_address(address),
|
origin_id: "osm:" <> to_string(Map.get(body, "osm_id"))
|
||||||
origin_id: "osm:" <> to_string(Map.get(body, "osm_id"))
|
}
|
||||||
}
|
rescue
|
||||||
rescue
|
error in ArgumentError ->
|
||||||
e in ArgumentError ->
|
Logger.warn(inspect(error))
|
||||||
Logger.warn(inspect(e))
|
|
||||||
nil
|
nil
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec street_address(map()) :: String.t()
|
@spec street_address(map()) :: String.t()
|
||||||
|
|
|
@ -2,9 +2,11 @@ defmodule Mobilizon.Service.Geospatial.Photon do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
[Photon](https://photon.komoot.de) backend.
|
[Photon](https://photon.komoot.de) backend.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Service.Geospatial.Provider
|
|
||||||
require Logger
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Provider
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,13 @@ defmodule Mobilizon.Service.Geospatial.Provider do
|
||||||
## Shared options
|
## Shared options
|
||||||
|
|
||||||
* `:user_agent` User-Agent string to send to the backend. Defaults to `"Mobilizon"`
|
* `:user_agent` User-Agent string to send to the backend. Defaults to `"Mobilizon"`
|
||||||
* `:lang` Lang in which to prefer results. Used as a request parameter or through an `Accept-Language` HTTP header.
|
* `:lang` Lang in which to prefer results. Used as a request parameter or
|
||||||
Defaults to `"en"`.
|
through an `Accept-Language` HTTP header. Defaults to `"en"`.
|
||||||
* `:limit` Maximum limit for the number of results returned by the backend. Defaults to `10`
|
* `:limit` Maximum limit for the number of results returned by the backend.
|
||||||
* `:api_key` Allows to override the API key (if the backend requires one) set inside the configuration.
|
Defaults to `10`
|
||||||
* `:endpoint` Allows to override the endpoint set inside the configuration
|
* `:api_key` Allows to override the API key (if the backend requires one) set
|
||||||
|
inside the configuration.
|
||||||
|
* `:endpoint` Allows to override the endpoint set inside the configuration.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
@ -35,38 +37,40 @@ defmodule Mobilizon.Service.Geospatial.Provider do
|
||||||
iex> geocode(48.11, -1.77)
|
iex> geocode(48.11, -1.77)
|
||||||
%Address{}
|
%Address{}
|
||||||
"""
|
"""
|
||||||
@callback geocode(longitude :: number(), latitude :: number(), options :: keyword()) ::
|
@callback geocode(longitude :: number, latitude :: number, options :: keyword) :: [Address.t()]
|
||||||
list(Address.t())
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Search for an address
|
Search for an address
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
In addition to [the shared options](#module-shared-options), `c:search/2` also accepts the following options:
|
In addition to [the shared options](#module-shared-options), `c:search/2` also
|
||||||
|
accepts the following options:
|
||||||
|
|
||||||
* `coords` Map of coordinates (ex: `%{lon: 48.11, lat: -1.77}`) allowing to give a geographic priority to the search.
|
* `coords` Map of coordinates (ex: `%{lon: 48.11, lat: -1.77}`) allowing to
|
||||||
Defaults to `nil`
|
give a geographic priority to the search. Defaults to `nil`.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> search("10 rue Jangot")
|
iex> search("10 rue Jangot")
|
||||||
%Address{}
|
%Address{}
|
||||||
"""
|
"""
|
||||||
@callback search(address :: String.t(), options :: keyword()) :: list(Address.t())
|
@callback search(address :: String.t(), options :: keyword) :: [Address.t()]
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns a `Geo.Point` for given coordinates
|
Returns a `Geo.Point` for given coordinates
|
||||||
"""
|
"""
|
||||||
@spec coordinates(list(number()), number()) :: Geo.Point.t()
|
@spec coordinates([number], number) :: Geo.Point.t()
|
||||||
def coordinates(coords, srid \\ 4326)
|
def coordinates(coords, srid \\ 4326)
|
||||||
|
|
||||||
def coordinates([x, y], srid) when is_number(x) and is_number(y),
|
def coordinates([x, y], srid) when is_number(x) and is_number(y) do
|
||||||
do: %Geo.Point{coordinates: {x, y}, srid: srid}
|
%Geo.Point{coordinates: {x, y}, srid: srid}
|
||||||
|
end
|
||||||
|
|
||||||
def coordinates([x, y], srid) when is_bitstring(x) and is_bitstring(y),
|
def coordinates([x, y], srid) when is_bitstring(x) and is_bitstring(y) do
|
||||||
do: %Geo.Point{coordinates: {String.to_float(x), String.to_float(y)}, srid: srid}
|
%Geo.Point{coordinates: {String.to_float(x), String.to_float(y)}, srid: srid}
|
||||||
|
end
|
||||||
|
|
||||||
@spec coordinates(any()) :: nil
|
@spec coordinates(any) :: nil
|
||||||
def coordinates(_, _), do: nil
|
def coordinates(_, _), do: nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
defmodule Mobilizon.Service.Users.Activation do
|
defmodule Mobilizon.Service.Users.Activation do
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
|
||||||
|
alias Mobilizon.Service.Users.Tools
|
||||||
alias Mobilizon.Users
|
alias Mobilizon.Users
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
alias Mobilizon.Service.Users.Tools
|
|
||||||
|
|
||||||
alias MobilizonWeb.Email
|
alias MobilizonWeb.Email
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ defmodule Mobilizon.ActorsTest do
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
alias Mobilizon.{Actors, Config, Users}
|
alias Mobilizon.{Actors, Config, Users}
|
||||||
alias Mobilizon.Actors.{Actor, Member, Follower, Bot}
|
alias Mobilizon.Actors.{Actor, Bot, Follower, Member}
|
||||||
alias Mobilizon.Media.File, as: FileModel
|
alias Mobilizon.Media.File, as: FileModel
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Storage.Page
|
alias Mobilizon.Storage.Page
|
||||||
|
@ -311,9 +311,6 @@ defmodule Mobilizon.ActorsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "groups" do
|
describe "groups" do
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
|
|
||||||
@valid_attrs %{
|
@valid_attrs %{
|
||||||
summary: "some description",
|
summary: "some description",
|
||||||
suspended: true,
|
suspended: true,
|
||||||
|
@ -356,11 +353,7 @@ defmodule Mobilizon.ActorsTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
|
|
||||||
describe "bots" do
|
describe "bots" do
|
||||||
alias Mobilizon.Actors.Bot
|
|
||||||
|
|
||||||
@valid_attrs %{source: "some source", type: "some type"}
|
@valid_attrs %{source: "some source", type: "some type"}
|
||||||
@update_attrs %{source: "some updated source", type: "some updated type"}
|
@update_attrs %{source: "some updated source", type: "some updated type"}
|
||||||
@invalid_attrs %{source: nil, type: nil}
|
@invalid_attrs %{source: nil, type: nil}
|
||||||
|
@ -419,9 +412,6 @@ defmodule Mobilizon.ActorsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "followers" do
|
describe "followers" do
|
||||||
alias Mobilizon.Actors.Follower
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
|
|
||||||
@valid_attrs %{approved: true}
|
@valid_attrs %{approved: true}
|
||||||
@update_attrs %{approved: false}
|
@update_attrs %{approved: false}
|
||||||
@invalid_attrs %{approved: nil}
|
@invalid_attrs %{approved: nil}
|
||||||
|
@ -529,9 +519,6 @@ defmodule Mobilizon.ActorsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "members" do
|
describe "members" do
|
||||||
alias Mobilizon.Actors.Member
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
|
|
||||||
@valid_attrs %{role: :member}
|
@valid_attrs %{role: :member}
|
||||||
@update_attrs %{role: :not_approved}
|
@update_attrs %{role: :not_approved}
|
||||||
@invalid_attrs %{role: nil}
|
@invalid_attrs %{role: nil}
|
||||||
|
|
|
@ -3,7 +3,9 @@ defmodule Mobilizon.EventsTest do
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
|
alias Mobilizon.Events.{Comment, Event, Participant, Session, Tag, TagRelation, Track}
|
||||||
alias Mobilizon.Storage.Page
|
alias Mobilizon.Storage.Page
|
||||||
|
|
||||||
@event_valid_attrs %{
|
@event_valid_attrs %{
|
||||||
|
@ -17,8 +19,6 @@ defmodule Mobilizon.EventsTest do
|
||||||
}
|
}
|
||||||
|
|
||||||
describe "events" do
|
describe "events" do
|
||||||
alias Mobilizon.Events.Event
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
actor = insert(:actor)
|
actor = insert(:actor)
|
||||||
event = insert(:event, organizer_actor: actor, visibility: :public)
|
event = insert(:event, organizer_actor: actor, visibility: :public)
|
||||||
|
@ -176,8 +176,6 @@ defmodule Mobilizon.EventsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "tags" do
|
describe "tags" do
|
||||||
alias Mobilizon.Events.Tag
|
|
||||||
|
|
||||||
@valid_attrs %{title: "some title"}
|
@valid_attrs %{title: "some title"}
|
||||||
@update_attrs %{title: "some updated title"}
|
@update_attrs %{title: "some updated title"}
|
||||||
@invalid_attrs %{title: nil}
|
@invalid_attrs %{title: nil}
|
||||||
|
@ -227,9 +225,6 @@ defmodule Mobilizon.EventsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "tags_relations" do
|
describe "tags_relations" do
|
||||||
alias Mobilizon.Events.TagRelation
|
|
||||||
alias Mobilizon.Events.Tag
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
tag1 = insert(:tag)
|
tag1 = insert(:tag)
|
||||||
tag2 = insert(:tag)
|
tag2 = insert(:tag)
|
||||||
|
@ -302,9 +297,6 @@ defmodule Mobilizon.EventsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "participants" do
|
describe "participants" do
|
||||||
alias Mobilizon.Events.{Participant, Event}
|
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
|
|
||||||
@valid_attrs %{role: :creator}
|
@valid_attrs %{role: :creator}
|
||||||
@update_attrs %{role: :moderator}
|
@update_attrs %{role: :moderator}
|
||||||
@invalid_attrs %{role: :no_such_role}
|
@invalid_attrs %{role: :no_such_role}
|
||||||
|
@ -369,8 +361,6 @@ defmodule Mobilizon.EventsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "sessions" do
|
describe "sessions" do
|
||||||
alias Mobilizon.Events.Session
|
|
||||||
|
|
||||||
@valid_attrs %{
|
@valid_attrs %{
|
||||||
audios_urls: "some audios_urls",
|
audios_urls: "some audios_urls",
|
||||||
language: "some language",
|
language: "some language",
|
||||||
|
@ -463,8 +453,6 @@ defmodule Mobilizon.EventsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "tracks" do
|
describe "tracks" do
|
||||||
alias Mobilizon.Events.Track
|
|
||||||
|
|
||||||
@valid_attrs %{color: "some color", description: "some description", name: "some name"}
|
@valid_attrs %{color: "some color", description: "some description", name: "some name"}
|
||||||
@update_attrs %{
|
@update_attrs %{
|
||||||
color: "some updated color",
|
color: "some updated color",
|
||||||
|
@ -525,8 +513,6 @@ defmodule Mobilizon.EventsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "comments" do
|
describe "comments" do
|
||||||
alias Mobilizon.Events.Comment
|
|
||||||
|
|
||||||
@valid_attrs %{text: "some text"}
|
@valid_attrs %{text: "some text"}
|
||||||
@update_attrs %{text: "some updated text"}
|
@update_attrs %{text: "some updated text"}
|
||||||
@invalid_attrs %{text: nil, url: nil}
|
@invalid_attrs %{text: nil, url: nil}
|
||||||
|
|
|
@ -4,17 +4,19 @@
|
||||||
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/activity_pub/activity_pub_test.exs
|
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/activity_pub/activity_pub_test.exs
|
||||||
|
|
||||||
defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do
|
defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do
|
||||||
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
use Mobilizon.DataCase
|
use Mobilizon.DataCase
|
||||||
|
|
||||||
|
import Mock
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Actors.Actor
|
|
||||||
alias Mobilizon.Service.HTTPSignatures.Signature
|
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
alias Mobilizon.Service.HTTPSignatures.Signature
|
||||||
import Mock
|
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
HTTPoison.start()
|
HTTPoison.start()
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
defmodule Mobilizon.Service.ActivityPub.Converters.ActorTest do
|
defmodule Mobilizon.Service.ActivityPub.Converters.ActorTest do
|
||||||
use Mobilizon.DataCase
|
use Mobilizon.DataCase
|
||||||
alias Mobilizon.Service.ActivityPub.Converters.Actor, as: ActorConverter
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
alias Mobilizon.Service.ActivityPub.Converters.Actor, as: ActorConverter
|
||||||
|
|
||||||
describe "actor to AS" do
|
describe "actor to AS" do
|
||||||
test "valid actor to as" do
|
test "valid actor to as" do
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/activity_pub/transmogrifier_test.exs
|
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/activity_pub/transmogrifier_test.exs
|
||||||
|
|
||||||
defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||||
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
use Mobilizon.DataCase
|
use Mobilizon.DataCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
@ -13,9 +15,8 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.{Comment, Event, Participant}
|
alias Mobilizon.Events.{Comment, Event, Participant}
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Service.ActivityPub.{Utils, Activity}
|
alias Mobilizon.Service.ActivityPub.{Activity, Utils}
|
||||||
alias Mobilizon.Service.ActivityPub.Transmogrifier
|
alias Mobilizon.Service.ActivityPub.Transmogrifier
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
HTTPoison.start()
|
HTTPoison.start()
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
defmodule Mobilizon.Service.ActivityPub.UtilsTest do
|
defmodule Mobilizon.Service.ActivityPub.UtilsTest do
|
||||||
use Mobilizon.DataCase
|
|
||||||
import Mobilizon.Factory
|
|
||||||
alias Mobilizon.Service.ActivityPub.Utils
|
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
|
||||||
|
use Mobilizon.DataCase
|
||||||
|
|
||||||
|
import Mobilizon.Factory
|
||||||
|
|
||||||
|
alias Mobilizon.Service.ActivityPub.Utils
|
||||||
|
|
||||||
alias MobilizonWeb.Endpoint
|
alias MobilizonWeb.Endpoint
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
HTTPoison.start()
|
HTTPoison.start()
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
defmodule Mobilizon.Service.Admin.ActionLogServiceTest do
|
defmodule Mobilizon.Service.Admin.ActionLogServiceTest do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Test the ActionLogService module
|
Test the ActionLogService module.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Mobilizon.DataCase
|
use Mobilizon.DataCase
|
||||||
import Mobilizon.Service.Admin.ActionLogService
|
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
|
||||||
alias Mobilizon.Admin.ActionLog
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
import Mobilizon.Service.Admin.ActionLogService
|
||||||
|
|
||||||
|
alias Mobilizon.Admin.ActionLog
|
||||||
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
moderator_user = insert(:user, role: :moderator)
|
moderator_user = insert(:user, role: :moderator)
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
defmodule Mobilizon.Service.Geospatial.AddokTest do
|
defmodule Mobilizon.Service.Geospatial.AddokTest do
|
||||||
use Mobilizon.DataCase, async: false
|
|
||||||
alias Mobilizon.Service.Geospatial.Addok
|
|
||||||
alias Mobilizon.Addresses.Address
|
|
||||||
|
|
||||||
import Mock
|
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
@endpoint Application.get_env(:mobilizon, Mobilizon.Service.Geospatial.Addok)
|
use Mobilizon.DataCase, async: false
|
||||||
|> get_in([:endpoint])
|
|
||||||
|
import Mock
|
||||||
|
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Addok
|
||||||
|
|
||||||
|
@endpoint get_in(Application.get_env(:mobilizon, Addok), [:endpoint])
|
||||||
@fake_endpoint "https://domain.tld"
|
@fake_endpoint "https://domain.tld"
|
||||||
|
|
||||||
describe "search address" do
|
describe "search address" do
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
|
defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
|
||||||
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
use Mobilizon.DataCase, async: false
|
use Mobilizon.DataCase, async: false
|
||||||
alias Mobilizon.Service.Geospatial.GoogleMaps
|
|
||||||
alias Mobilizon.Addresses.Address
|
|
||||||
|
|
||||||
import Mock
|
import Mock
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.GoogleMaps
|
||||||
|
|
||||||
describe "search address" do
|
describe "search address" do
|
||||||
test "without API Key triggers an error" do
|
test "without API Key triggers an error" do
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
defmodule Mobilizon.Service.Geospatial.MapQuestTest do
|
defmodule Mobilizon.Service.Geospatial.MapQuestTest do
|
||||||
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
use Mobilizon.DataCase, async: false
|
use Mobilizon.DataCase, async: false
|
||||||
alias Mobilizon.Service.Geospatial.MapQuest
|
|
||||||
alias Mobilizon.Addresses.Address
|
|
||||||
|
|
||||||
import Mock
|
import Mock
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.MapQuest
|
||||||
|
|
||||||
describe "search address" do
|
describe "search address" do
|
||||||
test "without API Key triggers an error" do
|
test "without API Key triggers an error" do
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
defmodule Mobilizon.Service.Geospatial.NominatimTest do
|
defmodule Mobilizon.Service.Geospatial.NominatimTest do
|
||||||
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
use Mobilizon.DataCase, async: false
|
use Mobilizon.DataCase, async: false
|
||||||
alias Mobilizon.Service.Geospatial.Nominatim
|
|
||||||
alias Mobilizon.Addresses.Address
|
|
||||||
|
|
||||||
import Mock
|
import Mock
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Nominatim
|
||||||
|
|
||||||
describe "search address" do
|
describe "search address" do
|
||||||
test "produces a valid search address with options" do
|
test "produces a valid search address with options" do
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
defmodule Mobilizon.Service.Geospatial.PhotonTest do
|
defmodule Mobilizon.Service.Geospatial.PhotonTest do
|
||||||
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
use Mobilizon.DataCase, async: false
|
use Mobilizon.DataCase, async: false
|
||||||
alias Mobilizon.Service.Geospatial.Photon
|
|
||||||
alias Mobilizon.Addresses.Address
|
|
||||||
|
|
||||||
import Mock
|
import Mock
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Photon
|
||||||
|
|
||||||
describe "search address" do
|
describe "search address" do
|
||||||
test "produces a valid search address with options" do
|
test "produces a valid search address with options" do
|
||||||
|
|
|
@ -5,10 +5,10 @@ defmodule MobilizonWeb.API.ReportTest do
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Events.{Comment, Event}
|
alias Mobilizon.Events.{Comment, Event}
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
|
alias Mobilizon.Service.ActivityPub.Activity
|
||||||
alias Mobilizon.Users
|
alias Mobilizon.Users
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
alias Mobilizon.Service.ActivityPub.Activity
|
|
||||||
|
|
||||||
alias MobilizonWeb.API.Reports
|
alias MobilizonWeb.API.Reports
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
defmodule MobilizonWeb.API.SearchTest do
|
defmodule MobilizonWeb.API.SearchTest do
|
||||||
use ExUnit.Case, async: false
|
use ExUnit.Case, async: false
|
||||||
|
|
||||||
alias Mobilizon.Events
|
import Mock
|
||||||
alias Mobilizon.Events.Event
|
|
||||||
alias Mobilizon.Actors
|
alias Mobilizon.Actors
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
alias Mobilizon.Events
|
||||||
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Mobilizon.Storage.Page
|
alias Mobilizon.Storage.Page
|
||||||
|
|
||||||
alias MobilizonWeb.API.Search
|
alias MobilizonWeb.API.Search
|
||||||
|
|
||||||
import Mock
|
|
||||||
|
|
||||||
test "search an user by username" do
|
test "search an user by username" do
|
||||||
with_mock ActivityPub,
|
with_mock ActivityPub,
|
||||||
find_or_make_actor_from_nickname: fn "toto@domain.tld" -> {:ok, %Actor{id: 42}} end do
|
find_or_make_actor_from_nickname: fn "toto@domain.tld" -> {:ok, %Actor{id: 42}} end do
|
||||||
|
|
|
@ -4,16 +4,20 @@
|
||||||
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/web_finger/web_finger_controller_test.exs
|
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/web_finger/web_finger_controller_test.exs
|
||||||
|
|
||||||
defmodule MobilizonWeb.ActivityPubControllerTest do
|
defmodule MobilizonWeb.ActivityPubControllerTest do
|
||||||
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
use MobilizonWeb.ConnCase
|
use MobilizonWeb.ConnCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
alias MobilizonWeb.ActivityPub.ActorView
|
|
||||||
alias MobilizonWeb.PageView
|
|
||||||
alias Mobilizon.{Actors, Config}
|
alias Mobilizon.{Actors, Config}
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
alias MobilizonWeb.ActivityPub.ActorView
|
||||||
alias MobilizonWeb.Endpoint
|
alias MobilizonWeb.Endpoint
|
||||||
|
alias MobilizonWeb.PageView
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
conn = build_conn() |> put_req_header("accept", "application/activity+json")
|
conn = build_conn() |> put_req_header("accept", "application/activity+json")
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
defmodule MobilizonWeb.FeedControllerTest do
|
defmodule MobilizonWeb.FeedControllerTest do
|
||||||
use MobilizonWeb.ConnCase
|
use MobilizonWeb.ConnCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
|
||||||
alias MobilizonWeb.Endpoint
|
alias MobilizonWeb.Endpoint
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
describe "/@:preferred_username/feed/atom" do
|
describe "/@:preferred_username/feed/atom" do
|
||||||
test "it returns an RSS representation of the actor's public events if the actor is publicly visible",
|
test "it returns an RSS representation of the actor's public events if the actor is publicly visible",
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
defmodule MobilizonWeb.PageControllerTest do
|
defmodule MobilizonWeb.PageControllerTest do
|
||||||
use MobilizonWeb.ConnCase
|
use MobilizonWeb.ConnCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
|
||||||
alias MobilizonWeb.Endpoint
|
alias MobilizonWeb.Endpoint
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
conn = build_conn() |> put_req_header("accept", "text/html")
|
conn = build_conn() |> put_req_header("accept", "text/html")
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule MobilizonWeb.Resolvers.AdminResolverTest do
|
defmodule MobilizonWeb.Resolvers.AdminResolverTest do
|
||||||
alias MobilizonWeb.AbsintheHelpers
|
|
||||||
use MobilizonWeb.ConnCase
|
use MobilizonWeb.ConnCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
alias Mobilizon.Events.Event
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
alias Mobilizon.Events.Event
|
||||||
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
|
||||||
|
alias MobilizonWeb.AbsintheHelpers
|
||||||
|
|
||||||
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"
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule MobilizonWeb.Resolvers.ReportResolverTest do
|
defmodule MobilizonWeb.Resolvers.ReportResolverTest do
|
||||||
alias MobilizonWeb.AbsintheHelpers
|
|
||||||
use MobilizonWeb.ConnCase
|
use MobilizonWeb.ConnCase
|
||||||
|
|
||||||
import Mobilizon.Factory
|
import Mobilizon.Factory
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Mobilizon.Reports.{Report, Note}
|
alias Mobilizon.Reports.{Note, Report}
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
|
alias MobilizonWeb.AbsintheHelpers
|
||||||
|
|
||||||
describe "Resolver: Report a content" do
|
describe "Resolver: Report a content" do
|
||||||
test "create_report/3 creates a report", %{conn: conn} do
|
test "create_report/3 creates a report", %{conn: conn} do
|
||||||
|
|
|
@ -9,8 +9,8 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
|
||||||
alias Mobilizon.{Actors, Config, Users}
|
alias Mobilizon.{Actors, Config, Users}
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Service.Users.ResetPassword
|
alias Mobilizon.Service.Users.ResetPassword
|
||||||
alias Mobilizon.Users.User
|
|
||||||
alias Mobilizon.Users
|
alias Mobilizon.Users
|
||||||
|
alias Mobilizon.Users.User
|
||||||
|
|
||||||
alias MobilizonWeb.{AbsintheHelpers, Email}
|
alias MobilizonWeb.{AbsintheHelpers, Email}
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ defmodule Mobilizon.UploadTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp upload() do
|
defp upload do
|
||||||
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
|
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
|
||||||
|
|
||||||
file = %Plug.Upload{
|
file = %Plug.Upload{
|
||||||
|
|
|
@ -8,8 +8,8 @@ defmodule Mobilizon.Factory do
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Crypto
|
alias Mobilizon.Crypto
|
||||||
|
|
||||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
|
||||||
alias MobilizonWeb.Endpoint
|
alias MobilizonWeb.Endpoint
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
alias MobilizonWeb.Upload
|
alias MobilizonWeb.Upload
|
||||||
|
|
||||||
def user_factory do
|
def user_factory do
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
defmodule Mobilizon.Service.Geospatial.Mock do
|
defmodule Mobilizon.Service.Geospatial.Mock do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Mock for Geospatial Provider implementations
|
Mock for Geospatial Provider implementations.
|
||||||
"""
|
"""
|
||||||
alias Mobilizon.Service.Geospatial.Provider
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
alias Mobilizon.Service.Geospatial.Provider
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,14 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Mobilizon.RelayTest do
|
defmodule Mix.Tasks.Mobilizon.RelayTest do
|
||||||
alias Mobilizon.Actors.{Actor, Follower}
|
|
||||||
alias Mobilizon.Actors
|
|
||||||
alias Mobilizon.Service.ActivityPub.Relay
|
|
||||||
use Mobilizon.DataCase
|
|
||||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||||
|
|
||||||
|
use Mobilizon.DataCase
|
||||||
|
|
||||||
|
alias Mobilizon.Actors
|
||||||
|
alias Mobilizon.Actors.{Actor, Follower}
|
||||||
|
alias Mobilizon.Service.ActivityPub.Relay
|
||||||
|
|
||||||
describe "running follow" do
|
describe "running follow" do
|
||||||
test "relay is followed" do
|
test "relay is followed" do
|
||||||
use_cassette "relay/fetch_relay_follow" do
|
use_cassette "relay/fetch_relay_follow" do
|
||||||
|
|
Loading…
Reference in a new issue