Run mix format on Elixir 12
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -317,9 +317,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
|
||||
|
||||
e ->
|
||||
Logger.warn(
|
||||
"Unable to process Accept activity #{inspect(id)} for object #{inspect(accepted_object)} only returned #{
|
||||
inspect(e)
|
||||
}"
|
||||
"Unable to process Accept activity #{inspect(id)} for object #{inspect(accepted_object)} only returned #{inspect(e)}"
|
||||
)
|
||||
|
||||
:error
|
||||
@@ -347,9 +345,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
|
||||
|
||||
e ->
|
||||
Logger.warn(
|
||||
"Unable to process Reject activity #{inspect(id)} for object #{inspect(rejected_object)} only returned #{
|
||||
inspect(e)
|
||||
}"
|
||||
"Unable to process Reject activity #{inspect(id)} for object #{inspect(rejected_object)} only returned #{inspect(e)}"
|
||||
)
|
||||
|
||||
:error
|
||||
@@ -734,9 +730,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
|
||||
else
|
||||
{:is_admin, {:ok, %Member{}}} ->
|
||||
Logger.warn(
|
||||
"Person #{inspect(actor)} is not an admin from #{inspect(origin)} and can't remove member #{
|
||||
inspect(object)
|
||||
}"
|
||||
"Person #{inspect(actor)} is not an admin from #{inspect(origin)} and can't remove member #{inspect(object)}"
|
||||
)
|
||||
|
||||
{:error, "Member already removed"}
|
||||
|
||||
@@ -303,18 +303,14 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
|
||||
case role do
|
||||
:moderator ->
|
||||
Logger.debug(
|
||||
"Checking if activity actor #{actor_url} is a moderator from group from #{
|
||||
object.url
|
||||
}"
|
||||
"Checking if activity actor #{actor_url} is a moderator from group from #{object.url}"
|
||||
)
|
||||
|
||||
Actors.is_moderator?(actor_id, group_id)
|
||||
|
||||
:administrator ->
|
||||
Logger.debug(
|
||||
"Checking if activity actor #{actor_url} is an administrator from group from #{
|
||||
object.url
|
||||
}"
|
||||
"Checking if activity actor #{actor_url} is an administrator from group from #{object.url}"
|
||||
)
|
||||
|
||||
Actors.is_administrator?(actor_id, group_id)
|
||||
|
||||
@@ -104,9 +104,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Resource do
|
||||
@spec get_parent_id(String.t(), String.t()) :: Resource.t() | map()
|
||||
defp get_parent_id(context, resources_url) do
|
||||
Logger.debug(
|
||||
"Getting parentID for context #{inspect(context)} and with resources_url #{
|
||||
inspect(resources_url)
|
||||
}"
|
||||
"Getting parentID for context #{inspect(context)} and with resources_url #{inspect(resources_url)}"
|
||||
)
|
||||
|
||||
case Utils.get_url(context) do
|
||||
|
||||
@@ -170,9 +170,7 @@ defmodule Mix.Tasks.Mobilizon.Instance do
|
||||
"""
|
||||
To get started:
|
||||
1. Check the contents of the generated files.
|
||||
2. Run `sudo -u postgres psql -f #{escape_sh_path(psql_path)} && rm #{
|
||||
escape_sh_path(psql_path)
|
||||
}`.
|
||||
2. Run `sudo -u postgres psql -f #{escape_sh_path(psql_path)} && rm #{escape_sh_path(psql_path)}`.
|
||||
"""
|
||||
)
|
||||
else
|
||||
|
||||
@@ -66,9 +66,7 @@ defmodule Mix.Tasks.Mobilizon.Users.Clean do
|
||||
|
||||
Enum.each(deleted_users, fn deleted_user ->
|
||||
shell_info(
|
||||
"ID: #{deleted_user.id}, Email: #{deleted_user.email}, Profile: @#{
|
||||
hd(deleted_user.actors).preferred_username
|
||||
}"
|
||||
"ID: #{deleted_user.id}, Email: #{deleted_user.email}, Profile: @#{hd(deleted_user.actors).preferred_username}"
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -58,11 +58,9 @@ defmodule Mix.Tasks.Mobilizon.Users.Modify do
|
||||
An user has been modified with the following information:
|
||||
- email: #{user.email}
|
||||
- Role: #{user.role}
|
||||
- account status: #{
|
||||
if user.confirmed_at,
|
||||
do: "activated on #{DateTime.to_string(user.confirmed_at)} (UTC)",
|
||||
else: "disabled"
|
||||
}
|
||||
- account status: #{if user.confirmed_at,
|
||||
do: "activated on #{DateTime.to_string(user.confirmed_at)} (UTC)",
|
||||
else: "disabled"}
|
||||
""")
|
||||
else
|
||||
{:makes_changes, false} ->
|
||||
|
||||
@@ -19,11 +19,9 @@ defmodule Mix.Tasks.Mobilizon.Users.Show do
|
||||
actors <- Users.get_actors_for_user(user) do
|
||||
shell_info("""
|
||||
Informations for the user #{user.email}:
|
||||
- account status: #{
|
||||
if user.confirmed_at,
|
||||
do: "Activated on #{DateTime.to_string(user.confirmed_at)} (UTC)",
|
||||
else: "disabled"
|
||||
}
|
||||
- account status: #{if user.confirmed_at,
|
||||
do: "Activated on #{DateTime.to_string(user.confirmed_at)} (UTC)",
|
||||
else: "disabled"}
|
||||
- Role: #{user.role}
|
||||
#{display_actors(actors)}
|
||||
""")
|
||||
|
||||
@@ -1254,9 +1254,7 @@ defmodule Mobilizon.Actors do
|
||||
# Check if followed has blocked follower
|
||||
{:already_following, nil} <- {:already_following, is_following(follower, followed)} do
|
||||
Logger.info(
|
||||
"Making #{Actor.preferred_username_and_domain(follower)} follow #{
|
||||
Actor.preferred_username_and_domain(followed)
|
||||
} " <>
|
||||
"Making #{Actor.preferred_username_and_domain(follower)} follow #{Actor.preferred_username_and_domain(followed)} " <>
|
||||
"(approved: #{approved})"
|
||||
)
|
||||
|
||||
@@ -1269,9 +1267,7 @@ defmodule Mobilizon.Actors do
|
||||
else
|
||||
{:already_following, %Follower{}} ->
|
||||
{:error, :already_following,
|
||||
"Could not follow actor: you are already following #{
|
||||
Actor.preferred_username_and_domain(followed)
|
||||
}"}
|
||||
"Could not follow actor: you are already following #{Actor.preferred_username_and_domain(followed)}"}
|
||||
|
||||
{:suspended, _} ->
|
||||
{:error, :suspended,
|
||||
|
||||
@@ -85,9 +85,7 @@ defmodule Mobilizon.Addresses.Address do
|
||||
|
||||
def representation(%__MODULE__{} = address) do
|
||||
String.trim(
|
||||
"#{address.street} #{address.postal_code} #{address.locality} #{address.region} #{
|
||||
address.country
|
||||
}"
|
||||
"#{address.street} #{address.postal_code} #{address.locality} #{address.region} #{address.country}"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,9 +35,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do
|
||||
|
||||
with {:ok, %{status: 200, body: body}} <-
|
||||
GeospatialClient.get(
|
||||
"https://#{prefix}.mapquestapi.com/geocoding/v1/reverse?key=#{api_key}&location=#{
|
||||
lat
|
||||
},#{lon}&maxResults=#{limit}"
|
||||
"https://#{prefix}.mapquestapi.com/geocoding/v1/reverse?key=#{api_key}&location=#{lat},#{lon}&maxResults=#{limit}"
|
||||
),
|
||||
%{"results" => results, "info" => %{"statuscode" => 0}} <- body do
|
||||
results |> Enum.map(&process_data/1)
|
||||
@@ -63,9 +61,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do
|
||||
if is_nil(api_key), do: raise(ArgumentError, message: @api_key_missing_message)
|
||||
|
||||
url =
|
||||
"https://#{prefix}.mapquestapi.com/geocoding/v1/address?key=#{api_key}&location=#{
|
||||
URI.encode(q)
|
||||
}&maxResults=#{limit}"
|
||||
"https://#{prefix}.mapquestapi.com/geocoding/v1/address?key=#{api_key}&location=#{URI.encode(q)}&maxResults=#{limit}"
|
||||
|
||||
Logger.debug("Asking MapQuest for addresses with #{url}")
|
||||
|
||||
|
||||
@@ -42,14 +42,10 @@ defmodule Mobilizon.Service.Geospatial.Nominatim do
|
||||
url =
|
||||
case method do
|
||||
:search ->
|
||||
"#{endpoint}/search?format=geocodejson&q=#{URI.encode(args.q)}&limit=#{limit}&accept-language=#{
|
||||
lang
|
||||
}&addressdetails=1&namedetails=1"
|
||||
"#{endpoint}/search?format=geocodejson&q=#{URI.encode(args.q)}&limit=#{limit}&accept-language=#{lang}&addressdetails=1&namedetails=1"
|
||||
|
||||
:geocode ->
|
||||
"#{endpoint}/reverse?format=geocodejson&lat=#{args.lat}&lon=#{args.lon}&accept-language=#{
|
||||
lang
|
||||
}&addressdetails=1&namedetails=1"
|
||||
"#{endpoint}/reverse?format=geocodejson&lat=#{args.lat}&lon=#{args.lon}&accept-language=#{lang}&addressdetails=1&namedetails=1"
|
||||
|> add_parameter(options, :zoom)
|
||||
end
|
||||
|
||||
|
||||
@@ -93,9 +93,7 @@ defmodule Mobilizon.Service.Notifications.Scheduler do
|
||||
%DateTime{} = begins_on_shifted = shift_zone(begins_on, timezone)
|
||||
|
||||
Logger.debug(
|
||||
"Participation event start at #{inspect(begins_on_shifted)} (user timezone is #{
|
||||
timezone
|
||||
})"
|
||||
"Participation event start at #{inspect(begins_on_shifted)} (user timezone is #{timezone})"
|
||||
)
|
||||
|
||||
notification_date =
|
||||
|
||||
Reference in New Issue
Block a user