style: run mix format
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
675ac38289
commit
107bab33c9
@ -190,7 +190,10 @@ defmodule Mobilizon.GraphQL.Schema.Actors.GroupType do
|
||||
description: "The page in the paginated activity items list"
|
||||
)
|
||||
|
||||
arg(:limit, :integer, default_value: 10, description: "The limit of activity items per page")
|
||||
arg(:limit, :integer,
|
||||
default_value: 10,
|
||||
description: "The limit of activity items per page"
|
||||
)
|
||||
|
||||
arg(:type, :activity_type, description: "Filter by type of activity")
|
||||
arg(:author, :activity_author, description: "Filter by activity author")
|
||||
@ -213,7 +216,9 @@ defmodule Mobilizon.GraphQL.Schema.Actors.GroupType do
|
||||
enum :openness do
|
||||
value(:invite_only, description: "The actor can only be followed by invitation")
|
||||
|
||||
value(:moderated, description: "The actor needs to accept the following before it's effective")
|
||||
value(:moderated,
|
||||
description: "The actor needs to accept the following before it's effective"
|
||||
)
|
||||
|
||||
value(:open, description: "The actor is open to followings")
|
||||
end
|
||||
|
@ -26,7 +26,9 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do
|
||||
resolve: &Person.user_for_person/3
|
||||
)
|
||||
|
||||
field(:member_of, list_of(:member), description: "The list of groups this person is member of")
|
||||
field(:member_of, list_of(:member),
|
||||
description: "The list of groups this person is member of"
|
||||
)
|
||||
|
||||
field(:url, :string, description: "The ActivityPub actor's URL")
|
||||
field(:type, :actor_type, description: "The type of Actor (Person, Group,…)")
|
||||
@ -94,7 +96,10 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do
|
||||
description: "The page in the paginated participation list"
|
||||
)
|
||||
|
||||
arg(:limit, :integer, default_value: 10, description: "The limit of participations per page")
|
||||
arg(:limit, :integer,
|
||||
default_value: 10,
|
||||
description: "The limit of participations per page"
|
||||
)
|
||||
|
||||
resolve(&Person.person_participations/3)
|
||||
end
|
||||
@ -218,7 +223,10 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do
|
||||
field :create_person, :person do
|
||||
arg(:preferred_username, non_null(:string), description: "The username for the profile")
|
||||
|
||||
arg(:name, :string, description: "The displayed name for the new profile", default_value: "")
|
||||
arg(:name, :string,
|
||||
description: "The displayed name for the new profile",
|
||||
default_value: ""
|
||||
)
|
||||
|
||||
arg(:summary, :string, description: "The summary for the new profile", default_value: "")
|
||||
|
||||
@ -286,7 +294,10 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do
|
||||
field :register_person, :person do
|
||||
arg(:preferred_username, non_null(:string), description: "The username for the profile")
|
||||
|
||||
arg(:name, :string, description: "The displayed name for the new profile", default_value: "")
|
||||
arg(:name, :string,
|
||||
description: "The displayed name for the new profile",
|
||||
default_value: ""
|
||||
)
|
||||
|
||||
arg(:summary, :string, description: "The summary for the new profile", default_value: "")
|
||||
arg(:email, non_null(:string), description: "The email from the user previously created")
|
||||
@ -301,7 +312,11 @@ defmodule Mobilizon.GraphQL.Schema.Actors.PersonType do
|
||||
"The banner for the profile, either as an object or directly the ID of an existing media"
|
||||
)
|
||||
|
||||
middleware(Rajska.QueryAuthorization, permit: :all, scope: Mobilizon.Actors.Actor, args: %{})
|
||||
middleware(Rajska.QueryAuthorization,
|
||||
permit: :all,
|
||||
scope: Mobilizon.Actors.Actor,
|
||||
args: %{}
|
||||
)
|
||||
|
||||
resolve(&Person.register_person/3)
|
||||
end
|
||||
|
@ -102,7 +102,10 @@ defmodule Mobilizon.GraphQL.Schema.AddressType do
|
||||
description: "The page in the paginated search results list"
|
||||
)
|
||||
|
||||
arg(:limit, :integer, default_value: 10, description: "The limit of search results per page")
|
||||
arg(:limit, :integer,
|
||||
default_value: 10,
|
||||
description: "The limit of search results per page"
|
||||
)
|
||||
|
||||
arg(:type, :address_search_type, description: "Filter by type of results")
|
||||
middleware(Rajska.QueryAuthorization, permit: :all)
|
||||
|
@ -96,7 +96,9 @@ defmodule Mobilizon.GraphQL.Schema.Discussions.CommentType do
|
||||
arg(:in_reply_to_comment_id, :id, description: "The comment ID this one replies to")
|
||||
arg(:language, :string, description: "The comment language", default_value: "und")
|
||||
|
||||
arg(:is_announcement, :boolean, description: "Should this comment be announced to everyone?")
|
||||
arg(:is_announcement, :boolean,
|
||||
description: "Should this comment be announced to everyone?"
|
||||
)
|
||||
|
||||
middleware(Rajska.QueryAuthorization,
|
||||
permit: :user,
|
||||
@ -114,7 +116,9 @@ defmodule Mobilizon.GraphQL.Schema.Discussions.CommentType do
|
||||
arg(:comment_id, non_null(:id), description: "The comment ID")
|
||||
arg(:language, :string, description: "The comment language", default_value: "und")
|
||||
|
||||
arg(:is_announcement, :boolean, description: "Should this comment be announced to everyone?")
|
||||
arg(:is_announcement, :boolean,
|
||||
description: "Should this comment be announced to everyone?"
|
||||
)
|
||||
|
||||
middleware(Rajska.QueryAuthorization,
|
||||
permit: :user,
|
||||
|
@ -230,7 +230,9 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
||||
description: "Whether or not to allow anonymous participation (if the server allows it)"
|
||||
)
|
||||
|
||||
field(:offers, list_of(:event_offer), description: "The list of offers to show for this event")
|
||||
field(:offers, list_of(:event_offer),
|
||||
description: "The list of offers to show for this event"
|
||||
)
|
||||
|
||||
field(:participation_conditions, list_of(:event_participation_condition),
|
||||
description: "The list of participation conditions to accept to join this event"
|
||||
@ -414,7 +416,9 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
||||
description: "The event's organizer ID (as a person)"
|
||||
)
|
||||
|
||||
arg(:attributed_to_id, :id, description: "Who the event is attributed to ID (often a group)")
|
||||
arg(:attributed_to_id, :id,
|
||||
description: "Who the event is attributed to ID (often a group)"
|
||||
)
|
||||
|
||||
arg(:category, :event_category,
|
||||
default_value: "MEETING",
|
||||
@ -476,7 +480,9 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
||||
arg(:phone_address, :string, description: "Phone address for the event")
|
||||
arg(:organizer_actor_id, :id, description: "The event's organizer ID (as a person)")
|
||||
|
||||
arg(:attributed_to_id, :id, description: "Who the event is attributed to ID (often a group)")
|
||||
arg(:attributed_to_id, :id,
|
||||
description: "Who the event is attributed to ID (often a group)"
|
||||
)
|
||||
|
||||
arg(:category, :event_category, description: "The event's category")
|
||||
arg(:physical_address, :address_input, description: "The event's physical address")
|
||||
|
@ -25,7 +25,10 @@ defmodule Mobilizon.GraphQL.Schema.ResourceType do
|
||||
field(:type, :string, description: "The resource's type (if it's a folder)")
|
||||
field(:path, :string, description: "The resource's path")
|
||||
|
||||
field(:parent, :resource, description: "The resource's parent", resolve: dataloader(Resources))
|
||||
field(:parent, :resource,
|
||||
description: "The resource's parent",
|
||||
resolve: dataloader(Resources)
|
||||
)
|
||||
|
||||
field :children, :paginated_resource_list do
|
||||
description("Children resources in folder")
|
||||
|
@ -73,7 +73,9 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
|
||||
description: "The list of participations this user has",
|
||||
meta: [private: true, rule: :"read:user:participations"]
|
||||
) do
|
||||
arg(:after_datetime, :datetime, description: "Filter participations by event start datetime")
|
||||
arg(:after_datetime, :datetime,
|
||||
description: "Filter participations by event start datetime"
|
||||
)
|
||||
|
||||
arg(:before_datetime, :datetime, description: "Filter participations by event end datetime")
|
||||
|
||||
@ -148,7 +150,9 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
|
||||
|
||||
field(:last_sign_in_at, :datetime, description: "When the user previously signed-in")
|
||||
|
||||
field(:last_sign_in_ip, :string, description: "The IP adress the user previously sign-in with")
|
||||
field(:last_sign_in_ip, :string,
|
||||
description: "The IP adress the user previously sign-in with"
|
||||
)
|
||||
|
||||
field(:current_sign_in_at, :datetime, description: "When the user currenlty signed-in")
|
||||
|
||||
|
@ -1310,7 +1310,9 @@ defmodule Mobilizon.Actors do
|
||||
def schedule_key_rotation(%Actor{id: actor_id} = actor, delay) do
|
||||
Cachex.put(:actor_key_rotation, actor_id, true)
|
||||
|
||||
Workers.Background.enqueue("actor_key_rotation", %{"actor_id" => actor.id}, schedule_in: delay)
|
||||
Workers.Background.enqueue("actor_key_rotation", %{"actor_id" => actor.id},
|
||||
schedule_in: delay
|
||||
)
|
||||
|
||||
:ok
|
||||
end
|
||||
|
@ -108,7 +108,7 @@ defmodule Mobilizon.Events.Participant do
|
||||
end
|
||||
|
||||
# No lookalike symbols
|
||||
@symbols '6789BCDFGHJKLMNPQRTW'
|
||||
@symbols ~c"6789BCDFGHJKLMNPQRTW"
|
||||
@symbol_count Enum.count(@symbols) - 1
|
||||
@code_length 6
|
||||
|
||||
|
@ -183,15 +183,15 @@ defmodule Mobilizon.Service.Auth.LDAPAuthenticator do
|
||||
|
||||
@spec search_filter(String.t(), boolean()) :: any()
|
||||
defp search_filter(email, false) do
|
||||
:eldap.equalityMatch('mail', to_charlist(email))
|
||||
:eldap.equalityMatch(~c"mail", to_charlist(email))
|
||||
end
|
||||
|
||||
# If we need to filter for group memberships as well
|
||||
@spec search_filter(String.t(), String.t()) :: any()
|
||||
defp search_filter(email, group) when is_binary(group) do
|
||||
:eldap.and([
|
||||
:eldap.equalityMatch('mail', to_charlist(email)),
|
||||
:eldap.equalityMatch('memberOf', to_charlist(group))
|
||||
:eldap.equalityMatch(~c"mail", to_charlist(email)),
|
||||
:eldap.equalityMatch(~c"memberOf", to_charlist(group))
|
||||
])
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,10 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Discussions.Comment do
|
||||
@spec build_tags(Comment.t(), String.t()) :: list(Phoenix.HTML.safe())
|
||||
def build_tags(%Comment{deleted_at: nil} = comment, _locale) do
|
||||
[
|
||||
Tag.tag(:meta, property: "og:title", content: escape_text(Actor.display_name(comment.actor))),
|
||||
Tag.tag(:meta,
|
||||
property: "og:title",
|
||||
content: escape_text(Actor.display_name(comment.actor))
|
||||
),
|
||||
Tag.tag(:meta, property: "og:url", content: comment.url),
|
||||
Tag.tag(:meta, property: "og:description", content: comment.text),
|
||||
Tag.tag(:meta, property: "og:type", content: "website"),
|
||||
|
@ -20,7 +20,9 @@ defmodule Mobilizon.Repo.Migrations.CreateTodos do
|
||||
add(:creator_id, references(:actors, on_delete: :delete_all), null: false)
|
||||
add(:assigned_to_id, references(:actors, on_delete: :nilify_all))
|
||||
|
||||
add(:todo_list_id, references(:todo_lists, on_delete: :delete_all, type: :uuid), null: false)
|
||||
add(:todo_list_id, references(:todo_lists, on_delete: :delete_all, type: :uuid),
|
||||
null: false
|
||||
)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ defmodule Mobilizon.Federation.ActivityPubTest do
|
||||
date: Signature.generate_date_header()
|
||||
})
|
||||
|
||||
assert signature =~ "headers=\"(request-target) content-length date digest host\""
|
||||
assert signature =~ "headers=\"date host digest content-length (request-target)\""
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -84,7 +84,11 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.JoinTest do
|
||||
insert(:member, actor: actor_member_2, parent: group, role: :moderator)
|
||||
|
||||
%Event{url: event_url} =
|
||||
insert(:event, organizer_actor: organizer, join_options: :restricted, attributed_to: group)
|
||||
insert(:event,
|
||||
organizer_actor: organizer,
|
||||
join_options: :restricted,
|
||||
attributed_to: group
|
||||
)
|
||||
|
||||
join_data =
|
||||
File.read!("test/fixtures/mobilizon-join-activity.json")
|
||||
|
@ -62,8 +62,8 @@ defmodule Mobilizon.Service.Auth.LDAPAuthenticatorTest do
|
||||
wholeSubtree: fn -> :ok end,
|
||||
search: fn _connection, _options ->
|
||||
{:ok,
|
||||
{:eldap_search_result, [{:eldap_entry, '', [{'cn', [to_charlist("MyUser")]}]}], [],
|
||||
[]}}
|
||||
{:eldap_search_result, [{:eldap_entry, ~c"", [{~c"cn", [to_charlist("MyUser")]}]}],
|
||||
[], []}}
|
||||
end,
|
||||
close: fn _connection ->
|
||||
send(self(), :close_connection)
|
||||
@ -111,8 +111,8 @@ defmodule Mobilizon.Service.Auth.LDAPAuthenticatorTest do
|
||||
wholeSubtree: fn -> :ok end,
|
||||
search: fn _connection, _options ->
|
||||
{:ok,
|
||||
{:eldap_search_result, [{:eldap_entry, '', [{'cn', [to_charlist("MyUser")]}]}], [],
|
||||
[]}}
|
||||
{:eldap_search_result, [{:eldap_entry, ~c"", [{~c"cn", [to_charlist("MyUser")]}]}],
|
||||
[], []}}
|
||||
end,
|
||||
close: fn _connection ->
|
||||
send(self(), :close_connection)
|
||||
@ -149,7 +149,9 @@ defmodule Mobilizon.Service.Auth.LDAPAuthenticatorTest do
|
||||
with_mocks [
|
||||
{:eldap, [],
|
||||
[
|
||||
open: fn [^host], [{:port, ^port}, {:ssl, false} | _] -> {:error, 'connect failed'} end,
|
||||
open: fn [^host], [{:port, ^port}, {:ssl, false} | _] ->
|
||||
{:error, ~c"connect failed"}
|
||||
end,
|
||||
simple_bind: fn _connection, _dn, password ->
|
||||
case password do
|
||||
^admin_password -> :ok
|
||||
@ -160,7 +162,8 @@ defmodule Mobilizon.Service.Auth.LDAPAuthenticatorTest do
|
||||
wholeSubtree: fn -> :ok end,
|
||||
search: fn _connection, _options ->
|
||||
{:ok,
|
||||
{:eldap_search_result, [{:eldap_entry, '', [{'cn', [to_charlist("MyUser")]}]}], []}}
|
||||
{:eldap_search_result, [{:eldap_entry, ~c"", [{~c"cn", [to_charlist("MyUser")]}]}],
|
||||
[]}}
|
||||
end,
|
||||
close: fn _connection ->
|
||||
send(self(), :close_connection)
|
||||
|
@ -154,7 +154,11 @@ defmodule Mobilizon.Service.Notifications.SchedulerTest do
|
||||
%User{id: user_id} = user = insert(:user, locale: "fr")
|
||||
|
||||
settings =
|
||||
insert(:settings, user_id: user_id, notification_each_week: true, timezone: "Europe/Paris")
|
||||
insert(:settings,
|
||||
user_id: user_id,
|
||||
notification_each_week: true,
|
||||
timezone: "Europe/Paris"
|
||||
)
|
||||
|
||||
user = Map.put(user, :settings, settings)
|
||||
actor = insert(:actor, user: user)
|
||||
|
@ -166,7 +166,11 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
|
||||
%User{id: user_id} = user = insert(:user)
|
||||
|
||||
settings =
|
||||
insert(:settings, user_id: user_id, notification_each_week: true, timezone: "Europe/Paris")
|
||||
insert(:settings,
|
||||
user_id: user_id,
|
||||
notification_each_week: true,
|
||||
timezone: "Europe/Paris"
|
||||
)
|
||||
|
||||
user = Map.put(user, :settings, settings)
|
||||
%Actor{} = actor = insert(:actor, user: user)
|
||||
@ -186,7 +190,11 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
|
||||
%User{id: user_id} = user = insert(:user)
|
||||
|
||||
settings =
|
||||
insert(:settings, user_id: user_id, notification_each_week: true, timezone: "Europe/Paris")
|
||||
insert(:settings,
|
||||
user_id: user_id,
|
||||
notification_each_week: true,
|
||||
timezone: "Europe/Paris"
|
||||
)
|
||||
|
||||
user = %User{user | settings: settings}
|
||||
%Actor{} = actor = insert(:actor, user: user)
|
||||
@ -210,7 +218,11 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
|
||||
%User{id: user_id} = user = insert(:user)
|
||||
|
||||
settings =
|
||||
insert(:settings, user_id: user_id, notification_each_week: true, timezone: "Europe/Paris")
|
||||
insert(:settings,
|
||||
user_id: user_id,
|
||||
notification_each_week: true,
|
||||
timezone: "Europe/Paris"
|
||||
)
|
||||
|
||||
user = Map.put(user, :settings, settings)
|
||||
%Actor{} = actor = insert(:actor, user: user)
|
||||
@ -229,7 +241,11 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
|
||||
%User{id: user_id} = user = insert(:user, email: @email)
|
||||
|
||||
settings =
|
||||
insert(:settings, user_id: user_id, notification_each_week: true, timezone: "Europe/Paris")
|
||||
insert(:settings,
|
||||
user_id: user_id,
|
||||
notification_each_week: true,
|
||||
timezone: "Europe/Paris"
|
||||
)
|
||||
|
||||
user = Map.put(user, :settings, settings)
|
||||
%Actor{} = actor = insert(:actor, user: user)
|
||||
|
@ -23,7 +23,7 @@ defmodule Mobilizon.Web.WebFingerControllerTest do
|
||||
conn = get(conn, "/.well-known/host-meta")
|
||||
|
||||
assert response(conn, 200) ==
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><XRD xmlns=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\" xmlns:hm=\"http://host-meta.net/ns/1.0\"><hm:Host>mobilizon.test</hm:Host><Link rel=\"lrdd\" template=\"#{Endpoint.url()}/.well-known/webfinger?resource={uri}\" type=\"application/jrd+json\" /></XRD>"
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><XRD xmlns=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\" xmlns:hm=\"http://host-meta.net/ns/1.0\"><hm:Host>mobilizon.test</hm:Host><Link type=\"application/jrd+json\" template=\"#{Endpoint.url()}/.well-known/webfinger?resource={uri}\" rel=\"lrdd\" /></XRD>"
|
||||
|
||||
assert {"content-type", "application/xrd+xml; charset=utf-8"} in conn.resp_headers
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user