diff --git a/lib/graphql/schema/actors/group.ex b/lib/graphql/schema/actors/group.ex index f485c24d..3b0122a1 100644 --- a/lib/graphql/schema/actors/group.ex +++ b/lib/graphql/schema/actors/group.ex @@ -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 diff --git a/lib/graphql/schema/actors/person.ex b/lib/graphql/schema/actors/person.ex index d4207a74..c138e081 100644 --- a/lib/graphql/schema/actors/person.ex +++ b/lib/graphql/schema/actors/person.ex @@ -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 diff --git a/lib/graphql/schema/address.ex b/lib/graphql/schema/address.ex index f1ec42a9..a32f2f14 100644 --- a/lib/graphql/schema/address.ex +++ b/lib/graphql/schema/address.ex @@ -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) diff --git a/lib/graphql/schema/discussions/comment.ex b/lib/graphql/schema/discussions/comment.ex index 9b972827..bc9af213 100644 --- a/lib/graphql/schema/discussions/comment.ex +++ b/lib/graphql/schema/discussions/comment.ex @@ -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, diff --git a/lib/graphql/schema/event.ex b/lib/graphql/schema/event.ex index 544f565d..42b43533 100644 --- a/lib/graphql/schema/event.ex +++ b/lib/graphql/schema/event.ex @@ -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") diff --git a/lib/graphql/schema/resource.ex b/lib/graphql/schema/resource.ex index 8e48927e..18ee1e98 100644 --- a/lib/graphql/schema/resource.ex +++ b/lib/graphql/schema/resource.ex @@ -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") diff --git a/lib/graphql/schema/user.ex b/lib/graphql/schema/user.ex index be5ea3a9..ce4941ad 100644 --- a/lib/graphql/schema/user.ex +++ b/lib/graphql/schema/user.ex @@ -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") diff --git a/lib/mobilizon/actors/actors.ex b/lib/mobilizon/actors/actors.ex index 9e01f89f..73a6d626 100644 --- a/lib/mobilizon/actors/actors.ex +++ b/lib/mobilizon/actors/actors.ex @@ -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 diff --git a/lib/mobilizon/events/participant.ex b/lib/mobilizon/events/participant.ex index ad35d40a..086b7289 100644 --- a/lib/mobilizon/events/participant.ex +++ b/lib/mobilizon/events/participant.ex @@ -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 diff --git a/lib/service/auth/ldap_authenticator.ex b/lib/service/auth/ldap_authenticator.ex index 7a31b199..3368a0fc 100644 --- a/lib/service/auth/ldap_authenticator.ex +++ b/lib/service/auth/ldap_authenticator.ex @@ -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 diff --git a/lib/service/metadata/comment.ex b/lib/service/metadata/comment.ex index dcdcc040..6eefd4d4 100644 --- a/lib/service/metadata/comment.ex +++ b/lib/service/metadata/comment.ex @@ -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"), diff --git a/priv/repo/migrations/20200221095721_create_todos.exs b/priv/repo/migrations/20200221095721_create_todos.exs index 31c1bfeb..b4d6a8c2 100644 --- a/priv/repo/migrations/20200221095721_create_todos.exs +++ b/priv/repo/migrations/20200221095721_create_todos.exs @@ -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 diff --git a/test/federation/activity_pub/activity_pub_test.exs b/test/federation/activity_pub/activity_pub_test.exs index 70e7ce8d..f316e09d 100644 --- a/test/federation/activity_pub/activity_pub_test.exs +++ b/test/federation/activity_pub/activity_pub_test.exs @@ -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 diff --git a/test/federation/activity_pub/transmogrifier/join_test.exs b/test/federation/activity_pub/transmogrifier/join_test.exs index 3055f881..4dd62774 100644 --- a/test/federation/activity_pub/transmogrifier/join_test.exs +++ b/test/federation/activity_pub/transmogrifier/join_test.exs @@ -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") diff --git a/test/service/auth/ldap_authentificator_test.exs b/test/service/auth/ldap_authentificator_test.exs index 9136c217..caf7f4f9 100644 --- a/test/service/auth/ldap_authentificator_test.exs +++ b/test/service/auth/ldap_authentificator_test.exs @@ -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) diff --git a/test/service/notifications/scheduler_test.exs b/test/service/notifications/scheduler_test.exs index 318213a4..3d99310d 100644 --- a/test/service/notifications/scheduler_test.exs +++ b/test/service/notifications/scheduler_test.exs @@ -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) diff --git a/test/service/workers/notification_test.exs b/test/service/workers/notification_test.exs index 58c8af17..355980fe 100644 --- a/test/service/workers/notification_test.exs +++ b/test/service/workers/notification_test.exs @@ -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) diff --git a/test/web/controllers/webfinger_controller_test.exs b/test/web/controllers/webfinger_controller_test.exs index c4d2a894..bc500151 100644 --- a/test/web/controllers/webfinger_controller_test.exs +++ b/test/web/controllers/webfinger_controller_test.exs @@ -23,7 +23,7 @@ defmodule Mobilizon.Web.WebFingerControllerTest do conn = get(conn, "/.well-known/host-meta") assert response(conn, 200) == - "mobilizon.test" + "mobilizon.test" assert {"content-type", "application/xrd+xml; charset=utf-8"} in conn.resp_headers end