From eb6bfb689651b8c1ad821356ba4fe8bdb55f95d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Charvet=20=E9=BB=91=E7=93=9C?= Date: Fri, 30 Aug 2024 09:47:32 +0100 Subject: [PATCH] Upgrade elixir otp (#432) * Upgrade elixir and otp Also upgrade dependencies that raised compiler warnings * Update versions for github CI * Fix a compiler warning * Upgrade gettext usage * Replace charlist with strings * mix format * Fix dialyzer * Use map() instead of Map.t() in typespeck * Fix new dialyzer errors * Update doc for local setup. --- .github/workflows/dialyzer.yml | 4 +- .github/workflows/format.yml | 4 +- .github/workflows/tests.yml | 4 +- .tool-versions | 4 +- config/prod.exs | 74 +++++++++---------- documents/guides/local_setup.md | 4 +- lib/teiserver/account.ex | 26 +++---- .../account/accolades/accolade_bot_server.ex | 2 +- .../account/accolades/accolade_chat_server.ex | 2 +- lib/teiserver/account/libs/accolade_lib.ex | 4 +- lib/teiserver/account/libs/auth_lib.ex | 6 +- lib/teiserver/account/libs/badge_type_lib.ex | 4 +- lib/teiserver/account/libs/client_lib.ex | 12 +-- lib/teiserver/account/libs/rating_lib.ex | 2 +- lib/teiserver/account/libs/smurf_key_lib.ex | 2 +- .../account/libs/smurf_key_type_lib.ex | 2 +- lib/teiserver/account/libs/user_lib.ex | 2 +- lib/teiserver/account/libs/user_stat_lib.ex | 2 +- lib/teiserver/account/schemas/accolade.ex | 4 +- lib/teiserver/account/schemas/badge_type.ex | 4 +- lib/teiserver/account/schemas/friend.ex | 4 +- .../account/schemas/friend_request.ex | 4 +- lib/teiserver/account/schemas/relationship.ex | 4 +- lib/teiserver/account/schemas/smurf_key.ex | 4 +- .../account/schemas/smurf_key_type.ex | 4 +- .../account/servers/client_server.ex | 2 +- .../account/servers/login_throttle_server.ex | 4 +- lib/teiserver/account/servers/party_server.ex | 2 +- lib/teiserver/battle.ex | 4 +- lib/teiserver/battle/api_auth.ex | 2 +- lib/teiserver/battle/libs/match_lib.ex | 4 +- lib/teiserver/battle/schemas/match.ex | 6 +- .../battle/servers/match_monitor_server.ex | 2 +- lib/teiserver/bridge/bridge_server.ex | 2 +- lib/teiserver/bridge/discord_bridge_bot.ex | 2 +- lib/teiserver/bridge/message_commands.ex | 10 ++- lib/teiserver/chat.ex | 12 +-- lib/teiserver/chat/chat_room_cache.ex | 14 ++-- lib/teiserver/chat/libs/lobby_message_lib.ex | 2 +- lib/teiserver/chat/libs/party_message_lib.ex | 2 +- lib/teiserver/chat/libs/room_message_lib.ex | 2 +- lib/teiserver/chat/schemas/direct_message.ex | 4 +- lib/teiserver/chat/schemas/lobby_message.ex | 4 +- lib/teiserver/chat/schemas/party_message.ex | 4 +- lib/teiserver/chat/schemas/room_message.ex | 2 +- lib/teiserver/clans/libs/clan_invite_lib.ex | 2 +- lib/teiserver/clans/libs/clan_lib.ex | 4 +- .../clans/libs/clan_membership_lib.ex | 2 +- lib/teiserver/common/email_helper.ex | 2 +- lib/teiserver/communication.ex | 4 +- .../communication/libs/text_callback_lib.ex | 4 +- .../communication/schemas/discord_channel.ex | 4 +- .../communication/schemas/text_callback.ex | 2 +- lib/teiserver/coordinator.ex | 2 +- lib/teiserver/coordinator/automod_server.ex | 2 +- lib/teiserver/coordinator/consul_commands.ex | 2 +- lib/teiserver/coordinator/consul_server.ex | 20 ++--- .../coordinator/coordinator_commands.ex | 4 +- lib/teiserver/coordinator/coordinator_lib.ex | 6 +- .../coordinator/coordinator_parser.ex | 6 +- .../coordinator/coordinator_server.ex | 2 +- lib/teiserver/coordinator/spads_parser.ex | 2 +- lib/teiserver/data/client.ex | 8 +- lib/teiserver/data/lobby_id_server.ex | 2 +- lib/teiserver/data/matchmaking.ex | 8 +- lib/teiserver/game.ex | 24 +++--- .../game/libs/achievement_type_lib.ex | 4 +- lib/teiserver/game/libs/lobby_policy_lib.ex | 4 +- lib/teiserver/game/libs/queue_lib.ex | 4 +- lib/teiserver/game/libs/rating_log_lib.ex | 4 +- lib/teiserver/game/libs/rating_type_lib.ex | 4 +- .../game/libs/user_achievement_lib.ex | 4 +- .../game/schemas/achievement_type.ex | 4 +- lib/teiserver/game/schemas/lobby_policy.ex | 4 +- lib/teiserver/game/schemas/queue.ex | 4 +- lib/teiserver/game/schemas/rating_log.ex | 4 +- lib/teiserver/game/schemas/rating_type.ex | 4 +- .../game/schemas/user_achievement.ex | 4 +- lib/teiserver/game/servers/balancer_server.ex | 2 +- .../game/servers/lobby_policy_bot_server.ex | 2 +- .../servers/lobby_policy_organiser_server.ex | 2 +- .../game/servers/queue_room_server.ex | 2 +- .../game/servers/queue_wait_server.ex | 10 +-- lib/teiserver/helpers/schema_helper.ex | 16 ++-- lib/teiserver/helpers/styling_helpers.ex | 4 +- lib/teiserver/lobby.ex | 8 +- lib/teiserver/lobby/libs/command_lib.ex | 6 +- lib/teiserver/lobby/servers/lobby_server.ex | 2 +- lib/teiserver/logging.ex | 8 +- lib/teiserver/logging/lib/logging_helpers.ex | 8 +- .../logging/schemas/match_day_log.ex | 4 +- .../logging/schemas/match_month_log.ex | 4 +- .../logging/schemas/server_day_log.ex | 4 +- .../logging/schemas/server_minute_log.ex | 4 +- .../logging/schemas/server_month_log.ex | 4 +- .../logging/schemas/server_quarter_log.ex | 4 +- .../logging/schemas/server_week_log.ex | 4 +- .../logging/schemas/server_year_log.ex | 4 +- .../logging/schemas/user_activity_day_log.ex | 4 +- lib/teiserver/microblog/schemas/post.ex | 4 +- lib/teiserver/microblog/schemas/post_tag.ex | 4 +- lib/teiserver/microblog/schemas/tag.ex | 4 +- .../microblog/schemas/user_preference.ex | 4 +- lib/teiserver/moderation.ex | 22 +++--- lib/teiserver/moderation/libs/action_lib.ex | 4 +- lib/teiserver/moderation/libs/ban_lib.ex | 4 +- lib/teiserver/moderation/libs/proposal_lib.ex | 4 +- .../moderation/libs/proposal_vote_lib.ex | 2 +- .../moderation/libs/report_group_lib.ex | 2 +- lib/teiserver/moderation/libs/report_lib.ex | 4 +- lib/teiserver/moderation/libs/response_lib.ex | 2 +- lib/teiserver/moderation/schemas/action.ex | 4 +- lib/teiserver/moderation/schemas/ban.ex | 4 +- lib/teiserver/moderation/schemas/proposal.ex | 4 +- .../moderation/schemas/proposal_vote.ex | 2 +- lib/teiserver/moderation/schemas/report.ex | 4 +- .../moderation/schemas/report_group.ex | 4 +- .../schemas/report_group_message.ex | 4 +- .../moderation/schemas/report_group_vote.ex | 4 +- lib/teiserver/moderation/schemas/response.ex | 4 +- lib/teiserver/protocols/spring/spring.ex | 8 +- .../protocols/spring/spring_auth_in.ex | 2 +- .../protocols/spring/spring_battle_in.ex | 2 +- lib/teiserver/protocols/spring/spring_in.ex | 4 +- .../spring/spring_lobby_policy_in.ex | 2 +- .../protocols/spring/spring_matchmaking_in.ex | 2 +- .../protocols/spring/spring_system_in.ex | 2 +- .../protocols/spring/spring_telemetry_in.ex | 2 +- .../protocols/spring/spring_user_in.ex | 2 +- lib/teiserver/servers/telemetry_server.ex | 4 +- lib/teiserver/tcp/spring/spring_tcp_server.ex | 2 +- lib/teiserver/telemetry.ex | 2 +- lib/teiserver/telemetry/libs/infolog_lib.ex | 2 +- .../telemetry/schemas/anon_property.ex | 4 +- .../telemetry/schemas/complex_anon_event.ex | 4 +- .../telemetry/schemas/complex_client_event.ex | 4 +- .../schemas/complex_client_event_type.ex | 4 +- .../telemetry/schemas/complex_lobby_event.ex | 4 +- .../schemas/complex_lobby_event_type.ex | 4 +- .../telemetry/schemas/complex_match_event.ex | 4 +- .../schemas/complex_match_event_type.ex | 4 +- .../telemetry/schemas/complex_server_event.ex | 4 +- .../schemas/complex_server_event_type.ex | 4 +- lib/teiserver/telemetry/schemas/infolog.ex | 4 +- .../telemetry/schemas/property_types.ex | 4 +- .../telemetry/schemas/simple_anon_event.ex | 4 +- .../telemetry/schemas/simple_client_event.ex | 4 +- .../schemas/simple_client_event_type.ex | 4 +- .../telemetry/schemas/simple_lobby_event.ex | 4 +- .../schemas/simple_lobby_event_type.ex | 4 +- .../telemetry/schemas/simple_match_event.ex | 4 +- .../schemas/simple_match_event_type.ex | 4 +- .../telemetry/schemas/simple_server_event.ex | 4 +- .../schemas/simple_server_event_type.ex | 4 +- .../telemetry/schemas/user_property.ex | 4 +- .../components/core_components.ex | 2 +- .../controllers/account/general_controller.ex | 2 +- .../account/security_controller.ex | 6 +- .../controllers/account/session_controller.ex | 14 ++-- .../controllers/admin/accolade_controller.ex | 20 ++--- .../admin/achievement_controller.ex | 18 ++--- .../controllers/admin/autohost_controller.ex | 4 +- .../admin/badge_type_controller.ex | 18 ++--- .../controllers/admin/chat_controller.ex | 6 +- .../controllers/admin/code_controller.ex | 14 ++-- .../admin/discord_channel_controller.ex | 18 ++--- .../controllers/admin/general_controller.ex | 2 +- .../controllers/admin/lobby_controller.ex | 4 +- .../admin/lobby_policy_controller.ex | 18 ++--- .../controllers/admin/match_controller.ex | 12 +-- .../admin/o_auth_application_controller.ex | 4 +- .../admin/site_config_controller.ex | 4 +- .../admin/text_callback_controller.ex | 18 ++--- .../controllers/admin/tool_controller.ex | 6 +- .../controllers/admin/user_controller.ex | 8 +- .../controllers/api/hailstorm_controller.ex | 2 +- .../controllers/api/session_controller.ex | 4 +- .../controllers/battle/general_controller.ex | 4 +- .../controllers/battle/match_controller.ex | 6 +- .../controllers/battle/ratings_controller.ex | 4 +- .../controllers/game/queue_controller.ex | 18 ++--- .../controllers/general/general_controller.ex | 6 +- .../logging/aggregate_view_log_controller.ex | 12 +-- .../logging/audit_log_controller.ex | 12 +-- .../controllers/logging/general_controller.ex | 4 +- .../logging/match_log_controller.ex | 4 +- .../logging/page_view_log_controller.ex | 14 ++-- .../moderation/action_controller.ex | 26 +++---- .../controllers/moderation/ban_controller.ex | 22 +++--- .../moderation/general_controller.ex | 4 +- .../moderation/proposal_controller.ex | 24 +++--- .../moderation/report_controller.ex | 26 +++---- .../controllers/moderation/user_controller.ex | 4 +- .../controllers/report/general_controller.ex | 2 +- .../controllers/report/rating_controller.ex | 4 +- .../controllers/report/report_controller.ex | 4 +- .../complex_client_event_controller.ex | 6 +- .../complex_lobby_event_controller.ex | 6 +- .../complex_match_event_controller.ex | 6 +- .../complex_server_event_controller.ex | 6 +- .../telemetry/general_controller.ex | 2 +- .../telemetry/infolog_controller.ex | 4 +- .../telemetry/property_controller.ex | 6 +- .../simple_client_event_controller.ex | 6 +- .../simple_lobby_event_controller.ex | 7 +- .../simple_match_event_controller.ex | 7 +- .../simple_server_event_controller.ex | 6 +- lib/teiserver_web/gettext.ex | 2 +- lib/teiserver_web/teiserver_web.ex | 2 +- .../account/general/edit_details.html.heex | 6 +- .../component/icon_dropdown.html.heex | 2 +- .../moderation/report/tab_details.html.heex | 4 +- mix.exs | 2 +- mix.lock | 24 +++--- test/support/teiserver_test_lib.ex | 2 +- .../battle/loser_picks_balance_test.exs | 6 +- test/teiserver/helpers/timex_helper_test.exs | 6 +- .../moderation/action_controller_test.exs | 4 +- 218 files changed, 654 insertions(+), 630 deletions(-) diff --git a/.github/workflows/dialyzer.yml b/.github/workflows/dialyzer.yml index b76c56e91..ee0a98eff 100644 --- a/.github/workflows/dialyzer.yml +++ b/.github/workflows/dialyzer.yml @@ -16,8 +16,8 @@ on: # Sets the ENV `MIX_ENV` to `test` for running tests env: MIX_ENV: test - ELIXIR_VER: '1.14.3' - OTP_VER: '25.2.3' + ELIXIR_VER: '1.16.3' + OTP_VER: '26.2.5.2' permissions: contents: read diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 87a1429c7..a04930ee5 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -16,8 +16,8 @@ on: # Sets the ENV `MIX_ENV` to `test` for running tests env: MIX_ENV: test - ELIXIR_VER: '1.14.3' - OTP_VER: '25.2.3' + ELIXIR_VER: '1.16.3' + OTP_VER: '26.2.5.2' permissions: contents: read diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bfb964803..cd595b31a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,8 +16,8 @@ on: # Sets the ENV `MIX_ENV` to `test` for running tests env: MIX_ENV: test - ELIXIR_VER: '1.14.3' - OTP_VER: '25.2.3' + ELIXIR_VER: '1.16.3' + OTP_VER: '26.2.5.2' permissions: contents: read diff --git a/.tool-versions b/.tool-versions index ba05ca28c..64c5c6073 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -erlang 25.2.3 -elixir 1.14.3-otp-25 +erlang 26.2.5.2 +elixir 1.16.3-otp-26 diff --git a/config/prod.exs b/config/prod.exs index f3fbc35aa..45dc4fcfb 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -15,43 +15,43 @@ config :teiserver, TeiserverWeb.Endpoint, port: 8888, otp_app: :teiserver, ciphers: [ - 'ECDHE-ECDSA-AES256-GCM-SHA384', - 'ECDHE-RSA-AES256-GCM-SHA384', - 'ECDHE-ECDSA-AES256-SHA384', - 'ECDHE-RSA-AES256-SHA384', - 'ECDHE-ECDSA-DES-CBC3-SHA', - 'ECDH-ECDSA-AES256-GCM-SHA384', - 'ECDH-RSA-AES256-GCM-SHA384', - 'ECDH-ECDSA-AES256-SHA384', - 'ECDH-RSA-AES256-SHA384', - 'DHE-DSS-AES256-GCM-SHA384', - 'DHE-DSS-AES256-SHA256', - 'AES256-GCM-SHA384', - 'AES256-SHA256', - 'ECDHE-ECDSA-AES128-GCM-SHA256', - 'ECDHE-RSA-AES128-GCM-SHA256', - 'ECDHE-ECDSA-AES128-SHA256', - 'ECDHE-RSA-AES128-SHA256', - 'ECDH-ECDSA-AES128-GCM-SHA256', - 'ECDH-RSA-AES128-GCM-SHA256', - 'ECDH-ECDSA-AES128-SHA256', - 'ECDH-RSA-AES128-SHA256', - 'DHE-DSS-AES128-GCM-SHA256', - 'DHE-DSS-AES128-SHA256', - 'AES128-GCM-SHA256', - 'AES128-SHA256', - 'ECDHE-ECDSA-AES256-SHA', - 'ECDHE-RSA-AES256-SHA', - 'DHE-DSS-AES256-SHA', - 'ECDH-ECDSA-AES256-SHA', - 'ECDH-RSA-AES256-SHA', - 'AES256-SHA', - 'ECDHE-ECDSA-AES128-SHA', - 'ECDHE-RSA-AES128-SHA', - 'DHE-DSS-AES128-SHA', - 'ECDH-ECDSA-AES128-SHA', - 'ECDH-RSA-AES128-SHA', - 'AES128-SHA' + "ECDHE-ECDSA-AES256-GCM-SHA384", + "ECDHE-RSA-AES256-GCM-SHA384", + "ECDHE-ECDSA-AES256-SHA384", + "ECDHE-RSA-AES256-SHA384", + "ECDHE-ECDSA-DES-CBC3-SHA", + "ECDH-ECDSA-AES256-GCM-SHA384", + "ECDH-RSA-AES256-GCM-SHA384", + "ECDH-ECDSA-AES256-SHA384", + "ECDH-RSA-AES256-SHA384", + "DHE-DSS-AES256-GCM-SHA384", + "DHE-DSS-AES256-SHA256", + "AES256-GCM-SHA384", + "AES256-SHA256", + "ECDHE-ECDSA-AES128-GCM-SHA256", + "ECDHE-RSA-AES128-GCM-SHA256", + "ECDHE-ECDSA-AES128-SHA256", + "ECDHE-RSA-AES128-SHA256", + "ECDH-ECDSA-AES128-GCM-SHA256", + "ECDH-RSA-AES128-GCM-SHA256", + "ECDH-ECDSA-AES128-SHA256", + "ECDH-RSA-AES128-SHA256", + "DHE-DSS-AES128-GCM-SHA256", + "DHE-DSS-AES128-SHA256", + "AES128-GCM-SHA256", + "AES128-SHA256", + "ECDHE-ECDSA-AES256-SHA", + "ECDHE-RSA-AES256-SHA", + "DHE-DSS-AES256-SHA", + "ECDH-ECDSA-AES256-SHA", + "ECDH-RSA-AES256-SHA", + "AES256-SHA", + "ECDHE-ECDSA-AES128-SHA", + "ECDHE-RSA-AES128-SHA", + "DHE-DSS-AES128-SHA", + "ECDH-ECDSA-AES128-SHA", + "ECDH-RSA-AES128-SHA", + "AES128-SHA" ], secure_renegotiate: true, reuse_sessions: true, diff --git a/documents/guides/local_setup.md b/documents/guides/local_setup.md index a1920346f..830406c7d 100644 --- a/documents/guides/local_setup.md +++ b/documents/guides/local_setup.md @@ -6,8 +6,8 @@ You will need to install: - [Elixir/Erlang installed](https://elixir-lang.org/install.html). - [Postresql](https://www.postgresql.org/download). -Make sure that Elixir is in correct version (I'm currently using 1.14). You can find required version [here](https://github.com/beyond-all-reason/teiserver/blob/master/mix.exs#L8). -You can use [asdf](https://github.com/asdf-vm/asdf) to install correct version. +Make sure that Elixir is in correct version (currently using 1.16). You can find required version [here](https://github.com/beyond-all-reason/teiserver/blob/master/mix.exs#L8). +You can use [asdf](https://github.com/asdf-vm/asdf) to install correct version, picked up from the file `.tool-version`. ### Clone repo ```bash diff --git a/lib/teiserver/account.ex b/lib/teiserver/account.ex index 2d13e1a29..8adda79a6 100644 --- a/lib/teiserver/account.ex +++ b/lib/teiserver/account.ex @@ -142,7 +142,7 @@ defmodule Teiserver.Account do |> Repo.one() end - @spec get_user_stat_data(integer()) :: Map.t() + @spec get_user_stat_data(integer()) :: map() def get_user_stat_data(userid) do Teiserver.cache_get_or_store(:teiserver_user_stat_cache, userid, fn -> case get_user_stat(userid) do @@ -309,7 +309,7 @@ defmodule Teiserver.Account do {:error, %Ecto.Changeset{}} """ - @spec create_badge_type(Map.t()) :: {:ok, BadgeType.t()} | {:error, Ecto.Changeset.t()} + @spec create_badge_type(map()) :: {:ok, BadgeType.t()} | {:error, Ecto.Changeset.t()} def create_badge_type(attrs \\ %{}) do %BadgeType{} |> BadgeType.changeset(attrs) @@ -328,7 +328,7 @@ defmodule Teiserver.Account do {:error, %Ecto.Changeset{}} """ - @spec update_badge_type(BadgeType.t(), Map.t()) :: + @spec update_badge_type(BadgeType.t(), map()) :: {:ok, BadgeType.t()} | {:error, Ecto.Changeset.t()} def update_badge_type(%BadgeType{} = badge_type, attrs) do badge_type @@ -464,7 +464,7 @@ defmodule Teiserver.Account do {:error, %Ecto.Changeset{}} """ - @spec create_accolade(Map.t()) :: {:ok, Accolade.t()} | {:error, Ecto.Changeset.t()} + @spec create_accolade(map()) :: {:ok, Accolade.t()} | {:error, Ecto.Changeset.t()} def create_accolade(attrs \\ %{}) do %Accolade{} |> Accolade.changeset(attrs) @@ -483,7 +483,7 @@ defmodule Teiserver.Account do {:error, %Ecto.Changeset{}} """ - @spec update_accolade(Accolade.t(), Map.t()) :: + @spec update_accolade(Accolade.t(), map()) :: {:ok, Accolade.t()} | {:error, Ecto.Changeset.t()} def update_accolade(%Accolade{} = accolade, attrs) do accolade @@ -683,7 +683,7 @@ defmodule Teiserver.Account do {:error, %Ecto.Changeset{}} """ - @spec update_smurf_key(SmurfKey.t(), Map.t()) :: + @spec update_smurf_key(SmurfKey.t(), map()) :: {:ok, SmurfKey.t()} | {:error, Ecto.Changeset.t()} def update_smurf_key(%SmurfKey{} = smurf_key, attrs) do smurf_key @@ -823,7 +823,7 @@ defmodule Teiserver.Account do {:error, %Ecto.Changeset{}} """ - @spec create_smurf_key_type(Map.t()) :: {:ok, SmurfKeyType.t()} | {:error, Ecto.Changeset.t()} + @spec create_smurf_key_type(map()) :: {:ok, SmurfKeyType.t()} | {:error, Ecto.Changeset.t()} def create_smurf_key_type(attrs \\ %{}) do %SmurfKeyType{} |> SmurfKeyType.changeset(attrs) @@ -985,7 +985,7 @@ defmodule Teiserver.Account do {:error, %Ecto.Changeset{}} """ - @spec create_rating(Map.t()) :: {:ok, Rating.t()} | {:error, Ecto.Changeset.t()} + @spec create_rating(map()) :: {:ok, Rating.t()} | {:error, Ecto.Changeset.t()} def create_rating(attrs \\ %{}) do %Rating{} |> Rating.changeset(attrs) @@ -1001,7 +1001,7 @@ defmodule Teiserver.Account do |> Repo.update() end - @spec create_or_update_rating(Map.t()) :: {:ok, Rating.t()} | {:error, Ecto.Changeset.t()} + @spec create_or_update_rating(map()) :: {:ok, Rating.t()} | {:error, Ecto.Changeset.t()} def create_or_update_rating(attrs \\ %{}) do case get_rating(attrs.user_id, attrs.rating_type_id) do nil -> @@ -2065,18 +2065,18 @@ defmodule Teiserver.Account do @spec list_clients([T.userid()]) :: [T.client()] defdelegate list_clients(id_list), to: ClientLib - @spec update_client(T.userid(), Map.t()) :: nil | :ok + @spec update_client(T.userid(), map()) :: nil | :ok defdelegate update_client(userid, partial_client), to: ClientLib # TODO: Remove these in favour of update_client - @spec merge_update_client(Map.t()) :: nil | :ok + @spec merge_update_client(map()) :: nil | :ok defdelegate merge_update_client(client), to: ClientLib - @spec merge_update_client(T.userid(), Map.t()) :: nil | :ok + @spec merge_update_client(T.userid(), map()) :: nil | :ok defdelegate merge_update_client(userid, client), to: ClientLib @spec replace_update_client( - Map.t(), + map(), :silent | :client_updated_status | :client_updated_battlestatus ) :: T.client() defdelegate replace_update_client(client, reason), to: ClientLib diff --git a/lib/teiserver/account/accolades/accolade_bot_server.ex b/lib/teiserver/account/accolades/accolade_bot_server.ex index c507bb8d6..ff407a3da 100644 --- a/lib/teiserver/account/accolades/accolade_bot_server.ex +++ b/lib/teiserver/account/accolades/accolade_bot_server.ex @@ -227,7 +227,7 @@ defmodule Teiserver.Account.AccoladeBotServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(_opts) do Horde.Registry.register( Teiserver.AccoladesRegistry, diff --git a/lib/teiserver/account/accolades/accolade_chat_server.ex b/lib/teiserver/account/accolades/accolade_chat_server.ex index cbb2c338e..a6d1a1657 100644 --- a/lib/teiserver/account/accolades/accolade_chat_server.ex +++ b/lib/teiserver/account/accolades/accolade_chat_server.ex @@ -207,7 +207,7 @@ defmodule Teiserver.Account.AccoladeChatServer do %{state | stage: :awaiting_choice} end - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(opts) do userid = opts[:userid] recipient_id = opts[:recipient_id] diff --git a/lib/teiserver/account/libs/accolade_lib.ex b/lib/teiserver/account/libs/accolade_lib.ex index a1ce0a627..825953607 100644 --- a/lib/teiserver/account/libs/accolade_lib.ex +++ b/lib/teiserver/account/libs/accolade_lib.ex @@ -17,7 +17,7 @@ defmodule Teiserver.Account.AccoladeLib do @spec colours :: atom def colours, do: :info - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(accolade) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), @@ -37,7 +37,7 @@ defmodule Teiserver.Account.AccoladeLib do from(accolades in Accolade) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/account/libs/auth_lib.ex b/lib/teiserver/account/libs/auth_lib.ex index 4c79dcf20..22fc7024f 100644 --- a/lib/teiserver/account/libs/auth_lib.ex +++ b/lib/teiserver/account/libs/auth_lib.ex @@ -5,7 +5,7 @@ defmodule Teiserver.Account.AuthLib do @spec icon :: String.t() def icon(), do: "fa-solid fa-address-card" - @spec get_all_permission_sets() :: Map.t() + @spec get_all_permission_sets() :: list() def get_all_permission_sets do Teiserver.store_get(:auth_group_store, :all) |> Enum.map(fn key -> {key, get_permission_set(key)} end) @@ -60,7 +60,7 @@ defmodule Teiserver.Account.AuthLib do end # If you don't need permissions then lets not bother checking - @spec allow?(Map.t() | Plug.Conn.t() | [String.t()], String.t() | [String.t()]) :: boolean + @spec allow?(map() | Plug.Conn.t() | [String.t()], String.t() | [String.t()]) :: boolean def allow?(nil, []), do: false def allow?(_, nil), do: true def allow?(_, ""), do: true @@ -144,7 +144,7 @@ defmodule Teiserver.Account.AuthLib do end @spec mount_require_any( - Map.t() | Plug.Conn.t() | Phoenix.LiveView.Socket.t(), + map() | Plug.Conn.t() | Phoenix.LiveView.Socket.t(), String.t() | [String.t()] ) :: Phoenix.LiveView.Socket def mount_require_any(obj, requirements) do diff --git a/lib/teiserver/account/libs/badge_type_lib.ex b/lib/teiserver/account/libs/badge_type_lib.ex index 849f6553d..20e468013 100644 --- a/lib/teiserver/account/libs/badge_type_lib.ex +++ b/lib/teiserver/account/libs/badge_type_lib.ex @@ -28,7 +28,7 @@ defmodule Teiserver.Account.BadgeTypeLib do "Role" ] - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(badge_type) do %{ type_colour: colours(), @@ -48,7 +48,7 @@ defmodule Teiserver.Account.BadgeTypeLib do from(badge_types in BadgeType) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/account/libs/client_lib.ex b/lib/teiserver/account/libs/client_lib.ex index 0a4d22f2a..ed67b7b96 100644 --- a/lib/teiserver/account/libs/client_lib.ex +++ b/lib/teiserver/account/libs/client_lib.ex @@ -79,25 +79,25 @@ defmodule Teiserver.Account.ClientLib do end # Updates - @spec merge_update_client(Map.t()) :: nil | :ok + @spec merge_update_client(map()) :: nil | :ok def merge_update_client(%{userid: userid} = partial_client) do cast_client(userid, {:update_values, partial_client}) end - @spec merge_update_client(T.userid(), Map.t()) :: nil | :ok + @spec merge_update_client(T.userid(), map()) :: nil | :ok def merge_update_client(userid, partial_client) do cast_client(userid, {:update_values, partial_client}) end - @spec update_client(T.userid(), Map.t()) :: nil | :ok + @spec update_client(T.userid(), map()) :: nil | :ok def update_client(userid, partial_client) do cast_client(userid, {:update_values, partial_client}) end @spec replace_update_client( - Map.t(), + map(), :silent | :client_updated_status | :client_updated_battlestatus - ) :: Map.t() + ) :: map() def replace_update_client(%{userid: userid} = client, :silent) do # Update the process with it cast_client(userid, {:update_client, client}) @@ -273,7 +273,7 @@ defmodule Teiserver.Account.ClientLib do # Used in tests to update a client based on user data # not intended to be used as part of standard operation - @spec refresh_client(T.userid()) :: Map.t() + @spec refresh_client(T.userid()) :: map() def refresh_client(userid) do user = Account.get_user_by_id(userid) stats = Account.get_user_stat_data(user.id) diff --git a/lib/teiserver/account/libs/rating_lib.ex b/lib/teiserver/account/libs/rating_lib.ex index bdc5d8964..e34f4f8d2 100644 --- a/lib/teiserver/account/libs/rating_lib.ex +++ b/lib/teiserver/account/libs/rating_lib.ex @@ -21,7 +21,7 @@ defmodule Teiserver.Account.RatingLib do from(ratings in Rating) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/account/libs/smurf_key_lib.ex b/lib/teiserver/account/libs/smurf_key_lib.ex index 7ed98122a..99c944a67 100644 --- a/lib/teiserver/account/libs/smurf_key_lib.ex +++ b/lib/teiserver/account/libs/smurf_key_lib.ex @@ -15,7 +15,7 @@ defmodule Teiserver.Account.SmurfKeyLib do from(smurf_keys in SmurfKey) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/account/libs/smurf_key_type_lib.ex b/lib/teiserver/account/libs/smurf_key_type_lib.ex index 0044c9012..feb73ede0 100644 --- a/lib/teiserver/account/libs/smurf_key_type_lib.ex +++ b/lib/teiserver/account/libs/smurf_key_type_lib.ex @@ -15,7 +15,7 @@ defmodule Teiserver.Account.SmurfKeyTypeLib do from(smurf_key_types in SmurfKeyType) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/account/libs/user_lib.ex b/lib/teiserver/account/libs/user_lib.ex index 41766eb0c..dfc100296 100644 --- a/lib/teiserver/account/libs/user_lib.ex +++ b/lib/teiserver/account/libs/user_lib.ex @@ -16,7 +16,7 @@ defmodule Teiserver.Account.UserLib do @spec colour :: atom def colour, do: :success - @spec make_favourite(Teiserver.Account.User.t()) :: Map.t() + @spec make_favourite(Teiserver.Account.User.t()) :: map() def make_favourite(user) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), diff --git a/lib/teiserver/account/libs/user_stat_lib.ex b/lib/teiserver/account/libs/user_stat_lib.ex index b33c3fb62..108eacf31 100644 --- a/lib/teiserver/account/libs/user_stat_lib.ex +++ b/lib/teiserver/account/libs/user_stat_lib.ex @@ -8,7 +8,7 @@ defmodule Teiserver.Account.UserStatLib do from(user_stats in UserStat) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/account/schemas/accolade.ex b/lib/teiserver/account/schemas/accolade.ex index 7a3c63cbf..f868443ee 100644 --- a/lib/teiserver/account/schemas/accolade.ex +++ b/lib/teiserver/account/schemas/accolade.ex @@ -12,7 +12,7 @@ defmodule Teiserver.Account.Accolade do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -25,6 +25,6 @@ defmodule Teiserver.Account.Accolade do |> foreign_key_constraint(:badge_type_id) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "Moderator") end diff --git a/lib/teiserver/account/schemas/badge_type.ex b/lib/teiserver/account/schemas/badge_type.ex index f07a4c359..b8be49b0a 100644 --- a/lib/teiserver/account/schemas/badge_type.ex +++ b/lib/teiserver/account/schemas/badge_type.ex @@ -15,7 +15,7 @@ defmodule Teiserver.Account.BadgeType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -26,6 +26,6 @@ defmodule Teiserver.Account.BadgeType do |> validate_required(~w(name icon colour purpose)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "Admin") end diff --git a/lib/teiserver/account/schemas/friend.ex b/lib/teiserver/account/schemas/friend.ex index e90045cf1..fe52c93ef 100644 --- a/lib/teiserver/account/schemas/friend.ex +++ b/lib/teiserver/account/schemas/friend.ex @@ -15,13 +15,13 @@ defmodule Teiserver.Account.Friend do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user1_id user2_id)a) |> validate_required(~w(user1_id user2_id)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Moderator") end diff --git a/lib/teiserver/account/schemas/friend_request.ex b/lib/teiserver/account/schemas/friend_request.ex index 0c11ace92..2147399e4 100644 --- a/lib/teiserver/account/schemas/friend_request.ex +++ b/lib/teiserver/account/schemas/friend_request.ex @@ -13,13 +13,13 @@ defmodule Teiserver.Account.FriendRequest do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(from_user_id to_user_id)a) |> validate_required(~w(from_user_id to_user_id)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Moderator") end diff --git a/lib/teiserver/account/schemas/relationship.ex b/lib/teiserver/account/schemas/relationship.ex index 86e0329e0..1ab07730b 100644 --- a/lib/teiserver/account/schemas/relationship.ex +++ b/lib/teiserver/account/schemas/relationship.ex @@ -20,7 +20,7 @@ defmodule Teiserver.Account.Relationship do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -31,6 +31,6 @@ defmodule Teiserver.Account.Relationship do |> validate_required(~w(from_user_id to_user_id)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Moderator") end diff --git a/lib/teiserver/account/schemas/smurf_key.ex b/lib/teiserver/account/schemas/smurf_key.ex index ca6fdc95c..1204799e2 100644 --- a/lib/teiserver/account/schemas/smurf_key.ex +++ b/lib/teiserver/account/schemas/smurf_key.ex @@ -11,7 +11,7 @@ defmodule Teiserver.Account.SmurfKey do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -22,6 +22,6 @@ defmodule Teiserver.Account.SmurfKey do |> validate_required(~w(value type_id user_id last_updated)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "Moderator") end diff --git a/lib/teiserver/account/schemas/smurf_key_type.ex b/lib/teiserver/account/schemas/smurf_key_type.ex index 05a64b625..a52b52c2c 100644 --- a/lib/teiserver/account/schemas/smurf_key_type.ex +++ b/lib/teiserver/account/schemas/smurf_key_type.ex @@ -8,13 +8,13 @@ defmodule Teiserver.Account.SmurfKeyType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/account/servers/client_server.ex b/lib/teiserver/account/servers/client_server.ex index b5bb0d29b..b821c78e0 100644 --- a/lib/teiserver/account/servers/client_server.ex +++ b/lib/teiserver/account/servers/client_server.ex @@ -223,7 +223,7 @@ defmodule Teiserver.Account.ClientServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(%{client: %{userid: userid}} = state) do Logger.metadata(request_id: "ClientServer##{userid}") :timer.send_interval(6_000, :heartbeat) diff --git a/lib/teiserver/account/servers/login_throttle_server.ex b/lib/teiserver/account/servers/login_throttle_server.ex index 9a30318e4..0fff438b6 100644 --- a/lib/teiserver/account/servers/login_throttle_server.ex +++ b/lib/teiserver/account/servers/login_throttle_server.ex @@ -434,7 +434,7 @@ defmodule Teiserver.Account.LoginThrottleServer do end end - @spec apply_server_capacity(Map.t(), Map.t()) :: map() + @spec apply_server_capacity(map(), map()) :: map() defp apply_server_capacity(state, telemetry_data) do total_limit = Config.get_site_config_cache("system.User limit") @@ -464,7 +464,7 @@ defmodule Teiserver.Account.LoginThrottleServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(_) do Logger.metadata(request_id: "LoginThrottleServer") diff --git a/lib/teiserver/account/servers/party_server.ex b/lib/teiserver/account/servers/party_server.ex index fb5ba9a15..2495715f5 100644 --- a/lib/teiserver/account/servers/party_server.ex +++ b/lib/teiserver/account/servers/party_server.ex @@ -275,7 +275,7 @@ defmodule Teiserver.Account.PartyServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(%{party: %{id: id} = party}) do Horde.Registry.register( Teiserver.PartyRegistry, diff --git a/lib/teiserver/battle.ex b/lib/teiserver/battle.ex index 2445d4a38..acdfdf73a 100644 --- a/lib/teiserver/battle.ex +++ b/lib/teiserver/battle.ex @@ -168,7 +168,7 @@ defmodule Teiserver.Battle do {:error, %Ecto.Changeset{}} """ - @spec create_match(Map.t()) :: {:ok, Match.t()} | {:error, Ecto.Changeset.t()} + @spec create_match(map()) :: {:ok, Match.t()} | {:error, Ecto.Changeset.t()} def create_match(attrs \\ %{}) do %Match{} |> Match.changeset(attrs) @@ -207,7 +207,7 @@ defmodule Teiserver.Battle do {:error, %Ecto.Changeset{}} """ - @spec update_match(Match.t(), Map.t()) :: {:ok, Match.t()} | {:error, Ecto.Changeset.t()} + @spec update_match(Match.t(), map()) :: {:ok, Match.t()} | {:error, Ecto.Changeset.t()} def update_match(%Match{} = match, attrs) do match |> Match.changeset(attrs) diff --git a/lib/teiserver/battle/api_auth.ex b/lib/teiserver/battle/api_auth.ex index 263310bb4..e601be17f 100644 --- a/lib/teiserver/battle/api_auth.ex +++ b/lib/teiserver/battle/api_auth.ex @@ -1,6 +1,6 @@ defmodule Teiserver.Battle.ApiAuth do import Teiserver.Account.AuthLib, only: [allow?: 2] - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "teiserver.api.battle") end diff --git a/lib/teiserver/battle/libs/match_lib.ex b/lib/teiserver/battle/libs/match_lib.ex index be2b14d40..5c6d9686d 100644 --- a/lib/teiserver/battle/libs/match_lib.ex +++ b/lib/teiserver/battle/libs/match_lib.ex @@ -157,7 +157,7 @@ defmodule Teiserver.Battle.MatchLib do end end - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(match) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), @@ -178,7 +178,7 @@ defmodule Teiserver.Battle.MatchLib do from(matches in Match) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/battle/schemas/match.ex b/lib/teiserver/battle/schemas/match.ex index 5977bd5ef..f32d64d68 100644 --- a/lib/teiserver/battle/schemas/match.ex +++ b/lib/teiserver/battle/schemas/match.ex @@ -40,7 +40,7 @@ defmodule Teiserver.Battle.Match do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast( @@ -52,7 +52,7 @@ defmodule Teiserver.Battle.Match do ) end - @spec initial_changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec initial_changeset(map(), map()) :: Ecto.Changeset.t() def initial_changeset(struct, params \\ %{}) do struct |> cast( @@ -62,6 +62,6 @@ defmodule Teiserver.Battle.Match do |> validate_required(~w(founder_id)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "account") end diff --git a/lib/teiserver/battle/servers/match_monitor_server.ex b/lib/teiserver/battle/servers/match_monitor_server.ex index 94c7c364f..97523e835 100644 --- a/lib/teiserver/battle/servers/match_monitor_server.ex +++ b/lib/teiserver/battle/servers/match_monitor_server.ex @@ -448,7 +448,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(_opts) do send(self(), :begin) Logger.metadata(request_id: "MatchMonitorServer") diff --git a/lib/teiserver/bridge/bridge_server.ex b/lib/teiserver/bridge/bridge_server.ex index 5b729dd72..d31263df5 100644 --- a/lib/teiserver/bridge/bridge_server.ex +++ b/lib/teiserver/bridge/bridge_server.ex @@ -474,7 +474,7 @@ defmodule Teiserver.Bridge.BridgeServer do defp message_starts_with?(message, text), do: String.starts_with?(message, text) @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(_opts) do if Teiserver.Communication.use_discord?() do send(self(), :begin) diff --git a/lib/teiserver/bridge/discord_bridge_bot.ex b/lib/teiserver/bridge/discord_bridge_bot.ex index 46c0db25f..f865f9d7e 100644 --- a/lib/teiserver/bridge/discord_bridge_bot.ex +++ b/lib/teiserver/bridge/discord_bridge_bot.ex @@ -209,7 +209,7 @@ defmodule Teiserver.Bridge.DiscordBridgeBot do Nostrum.Api.delete_guild_application_command(guild_id, cmd_id) end - @spec get_text_to_emoticon_map() :: Map.t() + @spec get_text_to_emoticon_map() :: map() def get_text_to_emoticon_map, do: @text_to_emoticon_map @spec new_dm_channel(atom | %{:recipients => any, optional(any) => any}) :: :ok diff --git a/lib/teiserver/bridge/message_commands.ex b/lib/teiserver/bridge/message_commands.ex index d0734d28c..294d5942f 100644 --- a/lib/teiserver/bridge/message_commands.ex +++ b/lib/teiserver/bridge/message_commands.ex @@ -6,11 +6,12 @@ defmodule Teiserver.Bridge.MessageCommands do alias Teiserver.Bridge.UnitNames alias Nostrum.Api require Logger + alias Teiserver.Data.Types, as: T @unauth ~w(discord) @always_allow ~w(whoami help whatwas unit) - @spec handle(Nostrum.Struct.Message.t()) :: any + @spec handle(Nostrum.Consumer.event()) :: any def handle(%Nostrum.Struct.Message{ author: %{id: author}, channel_id: channel, @@ -51,7 +52,12 @@ defmodule Teiserver.Bridge.MessageCommands do :ok end - @spec handle_command({T.user(), String.t()}, String.t(), String.t(), String.t()) :: any + @spec handle_command( + {T.user(), String.t()}, + String.t(), + String.t(), + Nostrum.Struct.Channel.id() + ) :: any def handle_command({nil, _discord_id}, "discord", "", channel) do reply( channel, diff --git a/lib/teiserver/chat.ex b/lib/teiserver/chat.ex index 3c947c66f..d7e28a8a1 100644 --- a/lib/teiserver/chat.ex +++ b/lib/teiserver/chat.ex @@ -101,7 +101,7 @@ defmodule Teiserver.Chat do {:error, %Ecto.Changeset{}} """ - @spec create_room_message(Map.t()) :: {:ok, RoomMessage.t()} | {:error, Ecto.Changeset.t()} + @spec create_room_message(map()) :: {:ok, RoomMessage.t()} | {:error, Ecto.Changeset.t()} def create_room_message(attrs \\ %{}) do %RoomMessage{} |> RoomMessage.changeset(attrs) @@ -120,7 +120,7 @@ defmodule Teiserver.Chat do {:error, %Ecto.Changeset{}} """ - @spec update_room_message(RoomMessage.t(), Map.t()) :: + @spec update_room_message(RoomMessage.t(), map()) :: {:ok, RoomMessage.t()} | {:error, Ecto.Changeset.t()} def update_room_message(%RoomMessage{} = room_message, attrs) do room_message @@ -257,7 +257,7 @@ defmodule Teiserver.Chat do {:error, %Ecto.Changeset{}} """ - @spec create_lobby_message(Map.t()) :: {:ok, LobbyMessage.t()} | {:error, Ecto.Changeset.t()} + @spec create_lobby_message(map()) :: {:ok, LobbyMessage.t()} | {:error, Ecto.Changeset.t()} def create_lobby_message(attrs \\ %{}) do %LobbyMessage{} |> LobbyMessage.changeset(attrs) @@ -276,7 +276,7 @@ defmodule Teiserver.Chat do {:error, %Ecto.Changeset{}} """ - @spec update_lobby_message(LobbyMessage.t(), Map.t()) :: + @spec update_lobby_message(LobbyMessage.t(), map()) :: {:ok, LobbyMessage.t()} | {:error, Ecto.Changeset.t()} def update_lobby_message(%LobbyMessage{} = lobby_message, attrs) do lobby_message @@ -413,7 +413,7 @@ defmodule Teiserver.Chat do {:error, %Ecto.Changeset{}} """ - @spec create_party_message(Map.t()) :: {:ok, PartyMessage.t()} | {:error, Ecto.Changeset.t()} + @spec create_party_message(map()) :: {:ok, PartyMessage.t()} | {:error, Ecto.Changeset.t()} def create_party_message(attrs \\ %{}) do %PartyMessage{} |> PartyMessage.changeset(attrs) @@ -432,7 +432,7 @@ defmodule Teiserver.Chat do {:error, %Ecto.Changeset{}} """ - @spec update_party_message(PartyMessage.t(), Map.t()) :: + @spec update_party_message(PartyMessage.t(), map()) :: {:ok, PartyMessage.t()} | {:error, Ecto.Changeset.t()} def update_party_message(%PartyMessage{} = party_message, attrs) do party_message diff --git a/lib/teiserver/chat/chat_room_cache.ex b/lib/teiserver/chat/chat_room_cache.ex index 1af6d0911..8cba40d45 100644 --- a/lib/teiserver/chat/chat_room_cache.ex +++ b/lib/teiserver/chat/chat_room_cache.ex @@ -8,9 +8,9 @@ defmodule Teiserver.Room do @dont_log_room ~w(autohosts) - @spec create_room(Map.t()) :: Map.t() - @spec create_room(String.t(), T.userid()) :: Map.t() - @spec create_room(String.t(), T.userid(), T.clan_id()) :: Map.t() + @spec create_room(map()) :: map() + @spec create_room(String.t(), T.userid()) :: map() + @spec create_room(String.t(), T.userid(), T.clan_id()) :: map() def create_room(%{name: _} = room) do Map.merge( %{ @@ -37,7 +37,7 @@ defmodule Teiserver.Room do Teiserver.cache_delete(:rooms, room_name) end - @spec get_room(String.t()) :: Map.t() + @spec get_room(String.t()) :: map() def get_room(name) do Teiserver.cache_get(:rooms, name) end @@ -62,8 +62,8 @@ defmodule Teiserver.Room do end end - @spec get_or_make_room(String.t(), T.userid()) :: Map.t() - @spec get_or_make_room(String.t(), T.userid(), T.clan_id()) :: Map.t() + @spec get_or_make_room(String.t(), T.userid()) :: map() + @spec get_or_make_room(String.t(), T.userid(), T.clan_id()) :: map() def get_or_make_room(name, author_id, clan_id \\ nil) do case Teiserver.cache_get(:rooms, name) do nil -> @@ -263,7 +263,7 @@ defmodule Teiserver.Room do end end - @spec allow?(Map.t(), String.t()) :: boolean() + @spec allow?(map(), String.t()) :: boolean() def allow?(userid, _room_name) do cond do CacheUser.is_shadowbanned?(userid) -> diff --git a/lib/teiserver/chat/libs/lobby_message_lib.ex b/lib/teiserver/chat/libs/lobby_message_lib.ex index 0a04a0642..3ef723790 100644 --- a/lib/teiserver/chat/libs/lobby_message_lib.ex +++ b/lib/teiserver/chat/libs/lobby_message_lib.ex @@ -16,7 +16,7 @@ defmodule Teiserver.Chat.LobbyMessageLib do from(lobby_messages in LobbyMessage) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/chat/libs/party_message_lib.ex b/lib/teiserver/chat/libs/party_message_lib.ex index 83ea1dccb..a78c6dbaa 100644 --- a/lib/teiserver/chat/libs/party_message_lib.ex +++ b/lib/teiserver/chat/libs/party_message_lib.ex @@ -15,7 +15,7 @@ defmodule Teiserver.Chat.PartyMessageLib do from(party_messages in PartyMessage) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/chat/libs/room_message_lib.ex b/lib/teiserver/chat/libs/room_message_lib.ex index edbf92bfc..3e13c71db 100644 --- a/lib/teiserver/chat/libs/room_message_lib.ex +++ b/lib/teiserver/chat/libs/room_message_lib.ex @@ -15,7 +15,7 @@ defmodule Teiserver.Chat.RoomMessageLib do from(room_messages in RoomMessage) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/chat/schemas/direct_message.ex b/lib/teiserver/chat/schemas/direct_message.ex index dea72d8cd..de66e50f6 100644 --- a/lib/teiserver/chat/schemas/direct_message.ex +++ b/lib/teiserver/chat/schemas/direct_message.ex @@ -13,7 +13,7 @@ defmodule Teiserver.Chat.DirectMessage do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -24,6 +24,6 @@ defmodule Teiserver.Chat.DirectMessage do |> validate_required(~w(content inserted_at from_id to_id delivered)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Moderator") end diff --git a/lib/teiserver/chat/schemas/lobby_message.ex b/lib/teiserver/chat/schemas/lobby_message.ex index aceaec253..6a4b4973e 100644 --- a/lib/teiserver/chat/schemas/lobby_message.ex +++ b/lib/teiserver/chat/schemas/lobby_message.ex @@ -12,7 +12,7 @@ defmodule Teiserver.Chat.LobbyMessage do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -23,7 +23,7 @@ defmodule Teiserver.Chat.LobbyMessage do |> validate_required(~w(content inserted_at user_id)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Reviewer") def authorize(_, conn, _), do: allow?(conn, "Moderator") end diff --git a/lib/teiserver/chat/schemas/party_message.ex b/lib/teiserver/chat/schemas/party_message.ex index 699459ad3..05579e3eb 100644 --- a/lib/teiserver/chat/schemas/party_message.ex +++ b/lib/teiserver/chat/schemas/party_message.ex @@ -11,7 +11,7 @@ defmodule Teiserver.Chat.PartyMessage do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -22,6 +22,6 @@ defmodule Teiserver.Chat.PartyMessage do |> validate_required(~w(content party_id inserted_at user_id)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "chat") end diff --git a/lib/teiserver/chat/schemas/room_message.ex b/lib/teiserver/chat/schemas/room_message.ex index 64694a0bf..1526db207 100644 --- a/lib/teiserver/chat/schemas/room_message.ex +++ b/lib/teiserver/chat/schemas/room_message.ex @@ -11,7 +11,7 @@ defmodule Teiserver.Chat.RoomMessage do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params diff --git a/lib/teiserver/clans/libs/clan_invite_lib.ex b/lib/teiserver/clans/libs/clan_invite_lib.ex index 1d83f1197..2043b5e88 100644 --- a/lib/teiserver/clans/libs/clan_invite_lib.ex +++ b/lib/teiserver/clans/libs/clan_invite_lib.ex @@ -8,7 +8,7 @@ defmodule Teiserver.Clans.ClanInviteLib do from(clan_invites in ClanInvite) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | keyword() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/clans/libs/clan_lib.ex b/lib/teiserver/clans/libs/clan_lib.ex index e75b8c9cd..8529f4fcf 100644 --- a/lib/teiserver/clans/libs/clan_lib.ex +++ b/lib/teiserver/clans/libs/clan_lib.ex @@ -9,7 +9,7 @@ defmodule Teiserver.Clans.ClanLib do @spec colours :: atom def colours, do: :info2 - @spec make_favourite(Clan.t()) :: Map.t() + @spec make_favourite(Clan.t()) :: map() def make_favourite(clan) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), @@ -32,7 +32,7 @@ defmodule Teiserver.Clans.ClanLib do from(clans in Clan) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/clans/libs/clan_membership_lib.ex b/lib/teiserver/clans/libs/clan_membership_lib.ex index de5e24cdd..df61e9aed 100644 --- a/lib/teiserver/clans/libs/clan_membership_lib.ex +++ b/lib/teiserver/clans/libs/clan_membership_lib.ex @@ -8,7 +8,7 @@ defmodule Teiserver.Clans.ClanMembershipLib do from(clan_memberships in ClanMembership) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | keyword() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/common/email_helper.ex b/lib/teiserver/common/email_helper.ex index 6cb14b4f2..5e08cecd8 100644 --- a/lib/teiserver/common/email_helper.ex +++ b/lib/teiserver/common/email_helper.ex @@ -66,7 +66,7 @@ defmodule Teiserver.EmailHelper do end end - defp password_reset(user, code \\ nil) do + defp password_reset(user, code) do # We need this to enable recreating the email if we know it # should exist but at the same time we don't want # callers of this function to have to create the code diff --git a/lib/teiserver/communication.ex b/lib/teiserver/communication.ex index 93a808cae..cd3abc69e 100644 --- a/lib/teiserver/communication.ex +++ b/lib/teiserver/communication.ex @@ -114,7 +114,7 @@ defmodule Teiserver.Communication do {:error, %Ecto.Changeset{}} """ - @spec create_text_callback(Map.t()) :: {:ok, TextCallback.t()} | {:error, Ecto.Changeset.t()} + @spec create_text_callback(map()) :: {:ok, TextCallback.t()} | {:error, Ecto.Changeset.t()} def create_text_callback(attrs \\ %{}) do %TextCallback{} |> TextCallback.changeset(attrs) @@ -134,7 +134,7 @@ defmodule Teiserver.Communication do {:error, %Ecto.Changeset{}} """ - @spec update_text_callback(TextCallback.t(), Map.t()) :: + @spec update_text_callback(TextCallback.t(), map()) :: {:ok, TextCallback.t()} | {:error, Ecto.Changeset.t()} def update_text_callback(%TextCallback{} = text_callback, attrs) do text_callback diff --git a/lib/teiserver/communication/libs/text_callback_lib.ex b/lib/teiserver/communication/libs/text_callback_lib.ex index ca50e505f..071ec227a 100644 --- a/lib/teiserver/communication/libs/text_callback_lib.ex +++ b/lib/teiserver/communication/libs/text_callback_lib.ex @@ -11,7 +11,7 @@ defmodule Teiserver.Communication.TextCallbackLib do @spec colours :: atom def colours, do: :success2 - @spec make_favourite(Queue.t()) :: Map.t() + @spec make_favourite(Queue.t()) :: map() def make_favourite(text_callback) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), @@ -31,7 +31,7 @@ defmodule Teiserver.Communication.TextCallbackLib do from(text_callbacks in TextCallback) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/communication/schemas/discord_channel.ex b/lib/teiserver/communication/schemas/discord_channel.ex index 0066a7981..648c736f2 100644 --- a/lib/teiserver/communication/schemas/discord_channel.ex +++ b/lib/teiserver/communication/schemas/discord_channel.ex @@ -18,7 +18,7 @@ defmodule Teiserver.Communication.DiscordChannel do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name channel_id colour icon view_permission post_permission)a) @@ -26,6 +26,6 @@ defmodule Teiserver.Communication.DiscordChannel do |> unique_constraint(:name) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/communication/schemas/text_callback.ex b/lib/teiserver/communication/schemas/text_callback.ex index 654dd12a9..7dc4663c8 100644 --- a/lib/teiserver/communication/schemas/text_callback.ex +++ b/lib/teiserver/communication/schemas/text_callback.ex @@ -33,7 +33,7 @@ defmodule Teiserver.Communication.TextCallback do |> validate_length(:triggers, min: 1) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(:index, conn, _params), do: allow_any?(conn, ["Overwatch", "Contributor"]) def authorize(:show, conn, _params), do: allow_any?(conn, ["Overwatch", "Contributor"]) def authorize(_action, conn, _params), do: allow?(conn, "Admin") diff --git a/lib/teiserver/coordinator.ex b/lib/teiserver/coordinator.ex index 220f640c6..b318c130e 100644 --- a/lib/teiserver/coordinator.ex +++ b/lib/teiserver/coordinator.ex @@ -213,7 +213,7 @@ defmodule Teiserver.Coordinator do end # Other stuff - @spec attempt_battlestatus_update(T.client(), T.lobby_id()) :: {boolean, Map.t() | nil} | nil + @spec attempt_battlestatus_update(T.client(), T.lobby_id()) :: {boolean, map() | nil} | nil def attempt_battlestatus_update(client, lobby_id) do call_consul(lobby_id, {:request_user_change_status, client}) end diff --git a/lib/teiserver/coordinator/automod_server.ex b/lib/teiserver/coordinator/automod_server.ex index 1548b220e..1d619f27f 100644 --- a/lib/teiserver/coordinator/automod_server.ex +++ b/lib/teiserver/coordinator/automod_server.ex @@ -116,7 +116,7 @@ defmodule Teiserver.Coordinator.AutomodServer do {:reply, check_wrapper(userid), state} end - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(_opts) do Horde.Registry.register( Teiserver.ServerRegistry, diff --git a/lib/teiserver/coordinator/consul_commands.ex b/lib/teiserver/coordinator/consul_commands.ex index be421c0e6..71c2e73c4 100644 --- a/lib/teiserver/coordinator/consul_commands.ex +++ b/lib/teiserver/coordinator/consul_commands.ex @@ -20,7 +20,7 @@ defmodule Teiserver.Coordinator.ConsulCommands do """ @splitter "------------------------------------------------------" @split_delay 60_000 - @spec handle_command(Map.t(), Map.t()) :: Map.t() + @spec handle_command(map(), map()) :: map() @default_ban_reason "Banned" #################### For everybody diff --git a/lib/teiserver/coordinator/consul_server.ex b/lib/teiserver/coordinator/consul_server.ex index f31b5847b..0a215917e 100644 --- a/lib/teiserver/coordinator/consul_server.ex +++ b/lib/teiserver/coordinator/consul_server.ex @@ -616,13 +616,13 @@ defmodule Teiserver.Coordinator.ConsulServer do # Says if a status change is allowed to happen. If it is then an allowed status # is included with it. - @spec request_user_change_status(T.client(), map()) :: {boolean, Map.t() | nil} + @spec request_user_change_status(T.client(), map()) :: {boolean, map() | nil} defp request_user_change_status(client, state) do existing = Client.get_client_by_id(client.userid) request_user_change_status(client, existing, state) end - @spec request_user_change_status(T.client(), T.client(), map()) :: {boolean, Map.t() | nil} + @spec request_user_change_status(T.client(), T.client(), map()) :: {boolean, map() | nil} # defp request_user_change_status(new_client, %{moderator: true, ready: false}, _state), do: {true, %{new_client | player: false}} # defp request_user_change_status(new_client, %{moderator: true}, _state), do: {true, new_client} defp request_user_change_status(_new_client, nil, _state), do: {false, nil} @@ -890,7 +890,7 @@ defmodule Teiserver.Coordinator.ConsulServer do end end - @spec allow_join(T.userid(), Map.t()) :: {true, nil} | {false, String.t()} + @spec allow_join(T.userid(), map()) :: {true, nil} | {false, String.t()} defp allow_join(userid, state) do client = Client.get_client_by_id(userid) {ban_state, reason} = check_ban_state(userid, state) @@ -980,7 +980,7 @@ defmodule Teiserver.Coordinator.ConsulServer do end end - @spec allow_command?(Map.t(), Map.t()) :: boolean() + @spec allow_command?(map(), map()) :: boolean() defp allow_command?(%{senderid: senderid} = cmd, state) do client = Client.get_client_by_id(senderid) user = Account.get_user_by_id(senderid) @@ -1260,7 +1260,7 @@ defmodule Teiserver.Coordinator.ConsulServer do |> Enum.count() end - @spec get_user(String.t() | integer(), Map.t()) :: integer() | nil + @spec get_user(String.t() | integer(), map()) :: integer() | nil def get_user(id, _) when is_integer(id), do: id def get_user("", _), do: nil def get_user("#" <> id, _), do: int_parse(id) @@ -1292,13 +1292,13 @@ defmodule Teiserver.Coordinator.ConsulServer do end end - # @spec say_message(T.userid(), String.t(), Map.t()) :: Map.t() + # @spec say_message(T.userid(), String.t(), map()) :: map() # def say_message(senderid, msg, state) do # Lobby.say(senderid, msg, state.lobby_id) # state # end - @spec say_command(Map.t(), Map.t()) :: Map.t() + @spec say_command(map(), map()) :: map() def say_command(cmd = %{silent: true}, state), do: log_command(cmd, state) def say_command(cmd, state) do @@ -1308,7 +1308,7 @@ defmodule Teiserver.Coordinator.ConsulServer do end # Allows us to log the command even if it was silent - @spec log_command(Map.t(), Map.t()) :: Map.t() + @spec log_command(map(), map()) :: map() def log_command(cmd, state) do message = "$ " <> command_as_message(cmd) sender = CacheUser.get_user_by_id(cmd.senderid) @@ -1316,7 +1316,7 @@ defmodule Teiserver.Coordinator.ConsulServer do state end - @spec command_as_message(Map.t()) :: String.t() + @spec command_as_message(map()) :: String.t() def command_as_message(cmd) do remaining = if Map.get(cmd, :remaining), do: " #{cmd.remaining}", else: "" error = if Map.get(cmd, :error), do: " Error: #{cmd.error}", else: "" @@ -1415,7 +1415,7 @@ defmodule Teiserver.Coordinator.ConsulServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(opts) do lobby_id = opts[:lobby_id] diff --git a/lib/teiserver/coordinator/coordinator_commands.ex b/lib/teiserver/coordinator/coordinator_commands.ex index d00096e0a..da1571078 100644 --- a/lib/teiserver/coordinator/coordinator_commands.ex +++ b/lib/teiserver/coordinator/coordinator_commands.ex @@ -18,7 +18,7 @@ defmodule Teiserver.Coordinator.CoordinatorCommands do Enum.member?(@always_allow, command) || Enum.member?(@mod_allow, command) end - @spec allow_command?(Map.t(), Map.t()) :: boolean() + @spec allow_command?(map(), map()) :: boolean() defp allow_command?(%{senderid: senderid} = cmd, state) do client = Client.get_client_by_id(senderid) @@ -556,7 +556,7 @@ defmodule Teiserver.Coordinator.CoordinatorCommands do state end - @spec command_as_message(Map.t()) :: String.t() + @spec command_as_message(map()) :: String.t() defp command_as_message(cmd) do remaining = if Map.get(cmd, :remaining), do: " #{cmd.remaining}", else: "" error = if Map.get(cmd, :error), do: " Error: #{cmd.error}", else: "" diff --git a/lib/teiserver/coordinator/coordinator_lib.ex b/lib/teiserver/coordinator/coordinator_lib.ex index 916f348fe..38e9af47d 100644 --- a/lib/teiserver/coordinator/coordinator_lib.ex +++ b/lib/teiserver/coordinator/coordinator_lib.ex @@ -177,7 +177,7 @@ Multiple locks can be engaged at the same time When resolve_round finds circular references it drops them and they don't go anywhere. """ - @spec resolve_split(Map.t()) :: Map.t() + @spec resolve_split(map()) :: map() def resolve_split(split) do case resolve_round(split) do {:complete, result} -> result @@ -187,7 +187,7 @@ Multiple locks can be engaged at the same time |> Map.new() end - @spec resolve_round(Map.t()) :: {:incomplete | :complete, Map.t()} + @spec resolve_round(map()) :: {:incomplete | :complete, map()} defp resolve_round(split) do players = Map.keys(split) @@ -231,7 +231,7 @@ Multiple locks can be engaged at the same time end end - @spec remove_circular(Map.t()) :: Map.t() + @spec remove_circular(map()) :: map() defp remove_circular(split) do split |> Map.new(fn {k, v} -> diff --git a/lib/teiserver/coordinator/coordinator_parser.ex b/lib/teiserver/coordinator/coordinator_parser.ex index 2c78fce52..5eeaf83ce 100644 --- a/lib/teiserver/coordinator/coordinator_parser.ex +++ b/lib/teiserver/coordinator/coordinator_parser.ex @@ -30,7 +30,7 @@ defmodule Teiserver.Coordinator.Parser do end end - @spec parse_and_handle(Types.userid(), String.t(), Map.t()) :: :handled + @spec parse_and_handle(Types.userid(), String.t(), map()) :: :handled defp parse_and_handle(_, _, nil), do: :handled defp parse_and_handle(userid, msg, battle) do @@ -39,7 +39,7 @@ defmodule Teiserver.Coordinator.Parser do :handled end - @spec parse_command(T.userid(), String.t()) :: Map.t() + @spec parse_command(T.userid(), String.t()) :: map() def parse_command(userid, string) do %{ raw: string, @@ -63,7 +63,7 @@ defmodule Teiserver.Coordinator.Parser do end end - @spec parse_command_name(Map.t()) :: Map.t() + @spec parse_command_name(map()) :: map() defp parse_command_name(%{remaining: string} = cmd) do case Regex.run(~r/\$([a-z0-9\-\?]+) ?/, string) do [_, command_name] -> diff --git a/lib/teiserver/coordinator/coordinator_server.ex b/lib/teiserver/coordinator/coordinator_server.ex index 95f7dbf72..fff2501ac 100644 --- a/lib/teiserver/coordinator/coordinator_server.ex +++ b/lib/teiserver/coordinator/coordinator_server.ex @@ -355,7 +355,7 @@ defmodule Teiserver.Coordinator.CoordinatorServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(_opts) do Horde.Registry.register( Teiserver.ServerRegistry, diff --git a/lib/teiserver/coordinator/spads_parser.ex b/lib/teiserver/coordinator/spads_parser.ex index 8f647aece..ba61b9206 100644 --- a/lib/teiserver/coordinator/spads_parser.ex +++ b/lib/teiserver/coordinator/spads_parser.ex @@ -2,7 +2,7 @@ defmodule Teiserver.Coordinator.SpadsParser do @moduledoc false alias Teiserver.{CacheUser, Account, Telemetry, Battle} - @spec handle_in(String.t(), map()) :: {:host_update, Map.t()} | nil + @spec handle_in(String.t(), map()) :: {:host_update, map()} | nil def handle_in(msg, state) do cond do # Team Size diff --git a/lib/teiserver/data/client.ex b/lib/teiserver/data/client.ex index 26c834f19..8b6a84455 100644 --- a/lib/teiserver/data/client.ex +++ b/lib/teiserver/data/client.ex @@ -17,7 +17,7 @@ defmodule Teiserver.Client do alias Teiserver.Data.Types, as: T - @spec create(Map.t()) :: Map.t() + @spec create(map()) :: map() def create(client) do Map.merge( %{ @@ -70,7 +70,7 @@ defmodule Teiserver.Client do ) end - @spec reset_battlestatus(Map.t()) :: Map.t() + @spec reset_battlestatus(map()) :: map() def reset_battlestatus(client) do %{ client @@ -195,7 +195,7 @@ defmodule Teiserver.Client do @spec list_clients([T.userid()]) :: [T.client()] defdelegate list_clients(id_list), to: ClientLib - @spec update(Map.t(), :silent | :client_updated_status | :client_updated_battlestatus) :: + @spec update(map(), :silent | :client_updated_status | :client_updated_battlestatus) :: T.client() def update(client, reason), do: ClientLib.replace_update_client(client, reason) @@ -222,7 +222,7 @@ defmodule Teiserver.Client do end end - @spec leave_battle(Integer.t() | nil) :: Map.t() | nil + @spec leave_battle(Integer.t() | nil) :: map() | nil def leave_battle(nil), do: nil def leave_battle(userid) do diff --git a/lib/teiserver/data/lobby_id_server.ex b/lib/teiserver/data/lobby_id_server.ex index 684429e54..ffedc8383 100644 --- a/lib/teiserver/data/lobby_id_server.ex +++ b/lib/teiserver/data/lobby_id_server.ex @@ -62,7 +62,7 @@ defmodule Teiserver.LobbyIdServer do {:noreply, %{state | next_id: next_id}} end - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(_opts) do Horde.Registry.register( Teiserver.ServerRegistry, diff --git a/lib/teiserver/data/matchmaking.ex b/lib/teiserver/data/matchmaking.ex index eb67f1edf..1b5f572c0 100644 --- a/lib/teiserver/data/matchmaking.ex +++ b/lib/teiserver/data/matchmaking.ex @@ -154,19 +154,19 @@ defmodule Teiserver.Data.Matchmaking do {pid, match_id} end - @spec get_queue_and_info(T.queue_id()) :: {QueueStruct.t(), Map.t()} + @spec get_queue_and_info(T.queue_id()) :: {QueueStruct.t(), map()} def get_queue_and_info(id) when is_integer(id) do queue = Teiserver.cache_get(:teiserver_queues, id) info = call_queue_wait(id, :get_info) {queue, info} end - @spec get_queue_info(T.queue_id()) :: Map.t() + @spec get_queue_info(T.queue_id()) :: map() def get_queue_info(queue_id) when is_integer(queue_id) do call_queue_wait(queue_id, :get_info) end - @spec get_queue_info_for_group(T.queue_id(), T.party_id() | T.userid()) :: Map.t() + @spec get_queue_info_for_group(T.queue_id(), T.party_id() | T.userid()) :: map() def get_queue_info_for_group(queue_id, group_id) when is_integer(queue_id) do call_queue_wait(queue_id, {:get_info, group_id}) end @@ -419,7 +419,7 @@ defmodule Teiserver.Data.Matchmaking do end end - @spec add_queue_from_db(Map.t()) :: :ok + @spec add_queue_from_db(map()) :: :ok def add_queue_from_db(queue) do queue |> convert_queue() diff --git a/lib/teiserver/game.ex b/lib/teiserver/game.ex index f78f9a725..95efd9134 100644 --- a/lib/teiserver/game.ex +++ b/lib/teiserver/game.ex @@ -103,7 +103,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec create_queue(Map.t()) :: {:ok, Queue.t()} | {:error, Ecto.Changeset.t()} + @spec create_queue(map()) :: {:ok, Queue.t()} | {:error, Ecto.Changeset.t()} def create_queue(attrs \\ %{}) do %Queue{} |> Queue.changeset(attrs) @@ -130,7 +130,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec update_queue(Queue.t(), Map.t()) :: {:ok, Queue.t()} | {:error, Ecto.Changeset.t()} + @spec update_queue(Queue.t(), map()) :: {:ok, Queue.t()} | {:error, Ecto.Changeset.t()} def update_queue(%Queue{} = queue, attrs) do queue |> Queue.changeset(attrs) @@ -264,7 +264,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec create_achievement_type(Map.t()) :: + @spec create_achievement_type(map()) :: {:ok, AchievementType.t()} | {:error, Ecto.Changeset.t()} def create_achievement_type(attrs \\ %{}) do %AchievementType{} @@ -284,7 +284,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec update_achievement_type(AchievementType.t(), Map.t()) :: + @spec update_achievement_type(AchievementType.t(), map()) :: {:ok, AchievementType.t()} | {:error, Ecto.Changeset.t()} def update_achievement_type(%AchievementType{} = achievement_type, attrs) do achievement_type @@ -412,7 +412,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec create_user_achievement(Map.t()) :: + @spec create_user_achievement(map()) :: {:ok, UserAchievement.t()} | {:error, Ecto.Changeset.t()} def create_user_achievement(attrs \\ %{}) do %UserAchievement{} @@ -432,7 +432,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec update_user_achievement(UserAchievement.t(), Map.t()) :: + @spec update_user_achievement(UserAchievement.t(), map()) :: {:ok, UserAchievement.t()} | {:error, Ecto.Changeset.t()} def update_user_achievement(%UserAchievement{} = user_achievement, attrs) do user_achievement @@ -592,7 +592,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec create_rating_type(Map.t()) :: {:ok, RatingType.t()} | {:error, Ecto.Changeset.t()} + @spec create_rating_type(map()) :: {:ok, RatingType.t()} | {:error, Ecto.Changeset.t()} def create_rating_type(attrs \\ %{}) do %RatingType{} |> RatingType.changeset(attrs) @@ -611,7 +611,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec update_rating_type(RatingType.t(), Map.t()) :: + @spec update_rating_type(RatingType.t(), map()) :: {:ok, RatingType.t()} | {:error, Ecto.Changeset.t()} def update_rating_type(%RatingType{} = rating_type, attrs) do rating_type @@ -746,7 +746,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec create_rating_log(Map.t()) :: {:ok, RatingLog.t()} | {:error, Ecto.Changeset.t()} + @spec create_rating_log(map()) :: {:ok, RatingLog.t()} | {:error, Ecto.Changeset.t()} def create_rating_log(attrs \\ %{}) do %RatingLog{} |> RatingLog.changeset(attrs) @@ -765,7 +765,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec update_rating_log(RatingLog.t(), Map.t()) :: + @spec update_rating_log(RatingLog.t(), map()) :: {:ok, RatingLog.t()} | {:error, Ecto.Changeset.t()} def update_rating_log(%RatingLog{} = rating_log, attrs) do rating_log @@ -900,7 +900,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec create_lobby_policy(Map.t()) :: {:ok, LobbyPolicy.t()} | {:error, Ecto.Changeset.t()} + @spec create_lobby_policy(map()) :: {:ok, LobbyPolicy.t()} | {:error, Ecto.Changeset.t()} def create_lobby_policy(attrs \\ %{}) do %LobbyPolicy{} |> LobbyPolicy.changeset(attrs) @@ -919,7 +919,7 @@ defmodule Teiserver.Game do {:error, %Ecto.Changeset{}} """ - @spec update_lobby_policy(LobbyPolicy.t(), Map.t()) :: + @spec update_lobby_policy(LobbyPolicy.t(), map()) :: {:ok, LobbyPolicy.t()} | {:error, Ecto.Changeset.t()} def update_lobby_policy(%LobbyPolicy{} = lobby_policy, attrs) do lobby_policy diff --git a/lib/teiserver/game/libs/achievement_type_lib.ex b/lib/teiserver/game/libs/achievement_type_lib.ex index 8f3ce1e80..63786e0b1 100644 --- a/lib/teiserver/game/libs/achievement_type_lib.ex +++ b/lib/teiserver/game/libs/achievement_type_lib.ex @@ -9,7 +9,7 @@ defmodule Teiserver.Game.AchievementTypeLib do @spec colour :: atom def colour, do: :info2 - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(achievement_type) do %{ type_colour: colour(), @@ -29,7 +29,7 @@ defmodule Teiserver.Game.AchievementTypeLib do from(achievement_types in AchievementType) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/game/libs/lobby_policy_lib.ex b/lib/teiserver/game/libs/lobby_policy_lib.ex index 5e0c18125..47348e642 100644 --- a/lib/teiserver/game/libs/lobby_policy_lib.ex +++ b/lib/teiserver/game/libs/lobby_policy_lib.ex @@ -14,7 +14,7 @@ defmodule Teiserver.Game.LobbyPolicyLib do @spec colours :: atom def colours, do: :success2 - @spec make_favourite(Queue.t()) :: Map.t() + @spec make_favourite(Queue.t()) :: map() def make_favourite(lobby_policy) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), @@ -34,7 +34,7 @@ defmodule Teiserver.Game.LobbyPolicyLib do from(lobby_policies in LobbyPolicy) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/game/libs/queue_lib.ex b/lib/teiserver/game/libs/queue_lib.ex index 1dc8eeded..d05d1d0cf 100644 --- a/lib/teiserver/game/libs/queue_lib.ex +++ b/lib/teiserver/game/libs/queue_lib.ex @@ -9,7 +9,7 @@ defmodule Teiserver.Game.QueueLib do @spec colours :: atom def colours, do: :primary2 - @spec make_favourite(Queue.t()) :: Map.t() + @spec make_favourite(Queue.t()) :: map() def make_favourite(queue) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), @@ -29,7 +29,7 @@ defmodule Teiserver.Game.QueueLib do from(queues in Queue) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/game/libs/rating_log_lib.ex b/lib/teiserver/game/libs/rating_log_lib.ex index bdd9f4725..a2ed29513 100644 --- a/lib/teiserver/game/libs/rating_log_lib.ex +++ b/lib/teiserver/game/libs/rating_log_lib.ex @@ -9,7 +9,7 @@ defmodule Teiserver.Game.RatingLogLib do @spec colours :: atom def colours, do: :primary2 - @spec make_favourite(RatingLog.t()) :: Map.t() + @spec make_favourite(RatingLog.t()) :: map() def make_favourite(queue) do %{ type_colour: StylingHelper.colours(colours()) |> elem(0), @@ -29,7 +29,7 @@ defmodule Teiserver.Game.RatingLogLib do from(rating_logs in RatingLog) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/game/libs/rating_type_lib.ex b/lib/teiserver/game/libs/rating_type_lib.ex index a2f8dce34..2dc54355c 100644 --- a/lib/teiserver/game/libs/rating_type_lib.ex +++ b/lib/teiserver/game/libs/rating_type_lib.ex @@ -9,7 +9,7 @@ defmodule Teiserver.Game.RatingTypeLib do @spec colour :: atom def colour, do: :info2 - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(rating_type) do %{ type_colour: colour(), @@ -29,7 +29,7 @@ defmodule Teiserver.Game.RatingTypeLib do from(rating_types in RatingType) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/game/libs/user_achievement_lib.ex b/lib/teiserver/game/libs/user_achievement_lib.ex index d32997fb8..1221c2dc7 100644 --- a/lib/teiserver/game/libs/user_achievement_lib.ex +++ b/lib/teiserver/game/libs/user_achievement_lib.ex @@ -9,7 +9,7 @@ defmodule Teiserver.Game.UserAchievementLib do @spec colour :: atom def colour, do: :info2 - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(user_achievement) do %{ type_colour: colour(), @@ -29,7 +29,7 @@ defmodule Teiserver.Game.UserAchievementLib do from(user_achievements in UserAchievement) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/game/schemas/achievement_type.ex b/lib/teiserver/game/schemas/achievement_type.ex index 253f0d39a..740c8e379 100644 --- a/lib/teiserver/game/schemas/achievement_type.ex +++ b/lib/teiserver/game/schemas/achievement_type.ex @@ -15,7 +15,7 @@ defmodule Teiserver.Game.AchievementType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -26,6 +26,6 @@ defmodule Teiserver.Game.AchievementType do |> validate_required(~w(name grouping icon colour description rarity)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_action, conn, _params), do: allow?(conn, "Admin") end diff --git a/lib/teiserver/game/schemas/lobby_policy.ex b/lib/teiserver/game/schemas/lobby_policy.ex index 23f68e7ed..68c6cb33e 100644 --- a/lib/teiserver/game/schemas/lobby_policy.ex +++ b/lib/teiserver/game/schemas/lobby_policy.ex @@ -37,7 +37,7 @@ defmodule Teiserver.Game.LobbyPolicy do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -56,7 +56,7 @@ defmodule Teiserver.Game.LobbyPolicy do |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(:index, conn, _params), do: allow_any?(conn, ["Overwatch", "Contributor"]) def authorize(:show, conn, _params), do: allow_any?(conn, ["Overwatch", "Contributor"]) def authorize(_action, conn, _params), do: allow?(conn, "Server") diff --git a/lib/teiserver/game/schemas/queue.ex b/lib/teiserver/game/schemas/queue.ex index 9c24038c7..1b14886e0 100644 --- a/lib/teiserver/game/schemas/queue.ex +++ b/lib/teiserver/game/schemas/queue.ex @@ -39,7 +39,7 @@ defmodule Teiserver.Game.Queue do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -51,7 +51,7 @@ defmodule Teiserver.Game.Queue do |> validate_required(~w(name icon colour team_size team_count map_list)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(:index, _conn, _params), do: true def authorize(:show, _conn, _params), do: true def authorize(_action, conn, _params), do: allow?(conn, "Server") diff --git a/lib/teiserver/game/schemas/rating_log.ex b/lib/teiserver/game/schemas/rating_log.ex index 76a395f08..e869e2cd3 100644 --- a/lib/teiserver/game/schemas/rating_log.ex +++ b/lib/teiserver/game/schemas/rating_log.ex @@ -18,13 +18,13 @@ defmodule Teiserver.Game.RatingLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id rating_type_id match_id value inserted_at party_id)a) |> validate_required(~w(user_id rating_type_id value inserted_at)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "Admin") end diff --git a/lib/teiserver/game/schemas/rating_type.ex b/lib/teiserver/game/schemas/rating_type.ex index c087457ea..45c7655f4 100644 --- a/lib/teiserver/game/schemas/rating_type.ex +++ b/lib/teiserver/game/schemas/rating_type.ex @@ -10,7 +10,7 @@ defmodule Teiserver.Game.RatingType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -21,6 +21,6 @@ defmodule Teiserver.Game.RatingType do |> validate_required(~w(name icon colour)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_action, conn, _params), do: allow?(conn, "Admin") end diff --git a/lib/teiserver/game/schemas/user_achievement.ex b/lib/teiserver/game/schemas/user_achievement.ex index 836c73f87..63b53cc4a 100644 --- a/lib/teiserver/game/schemas/user_achievement.ex +++ b/lib/teiserver/game/schemas/user_achievement.ex @@ -15,13 +15,13 @@ defmodule Teiserver.Game.UserAchievement do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id achievement_type_id achieved progress inserted_at)a) |> validate_required(~w(user_id achievement_type_id achieved inserted_at)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, conn, _), do: allow?(conn, "account") end diff --git a/lib/teiserver/game/servers/balancer_server.ex b/lib/teiserver/game/servers/balancer_server.ex index d3f0b5c83..124635cca 100644 --- a/lib/teiserver/game/servers/balancer_server.ex +++ b/lib/teiserver/game/servers/balancer_server.ex @@ -279,7 +279,7 @@ defmodule Teiserver.Game.BalancerServer do end @impl true - @spec init(Map.t()) :: {:ok, T.balance_server_state()} + @spec init(map()) :: {:ok, T.balance_server_state()} def init(opts) do lobby_id = opts[:lobby_id] Logger.metadata(request_id: "BalancerServer##{opts.lobby_id}") diff --git a/lib/teiserver/game/servers/lobby_policy_bot_server.ex b/lib/teiserver/game/servers/lobby_policy_bot_server.ex index a2c3f84c8..6f25ee3b6 100644 --- a/lib/teiserver/game/servers/lobby_policy_bot_server.ex +++ b/lib/teiserver/game/servers/lobby_policy_bot_server.ex @@ -533,7 +533,7 @@ defmodule Teiserver.Game.LobbyPolicyBotServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(data) do id = data.lobby_policy.id diff --git a/lib/teiserver/game/servers/lobby_policy_organiser_server.ex b/lib/teiserver/game/servers/lobby_policy_organiser_server.ex index 81f746ca5..9160c7ede 100644 --- a/lib/teiserver/game/servers/lobby_policy_organiser_server.ex +++ b/lib/teiserver/game/servers/lobby_policy_organiser_server.ex @@ -171,7 +171,7 @@ defmodule Teiserver.Game.LobbyPolicyOrganiserServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(data) do id = data.lobby_policy.id diff --git a/lib/teiserver/game/servers/queue_room_server.ex b/lib/teiserver/game/servers/queue_room_server.ex index 7907a0f75..1c07eef77 100644 --- a/lib/teiserver/game/servers/queue_room_server.ex +++ b/lib/teiserver/game/servers/queue_room_server.ex @@ -492,7 +492,7 @@ defmodule Teiserver.Game.QueueRoomServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(opts) do send(self(), :initial_setup) Process.send_after(self(), :find_timeout, @find_timeout) diff --git a/lib/teiserver/game/servers/queue_wait_server.ex b/lib/teiserver/game/servers/queue_wait_server.ex index d92dfb97a..d8b385b97 100644 --- a/lib/teiserver/game/servers/queue_wait_server.ex +++ b/lib/teiserver/game/servers/queue_wait_server.ex @@ -543,7 +543,7 @@ defmodule Teiserver.Game.QueueWaitServer do # Used to remove players from all aspects of the queue, either because # they left or their game started - @spec remove_group(T.userid() | String.t(), Map.t()) :: Map.t() + @spec remove_group(T.userid() | String.t(), map()) :: map() defp remove_group(group_id, state) do # Drop the selected ids from any bucket values new_buckets = @@ -559,7 +559,7 @@ defmodule Teiserver.Game.QueueWaitServer do end # One or more groups found a match, pause them - @spec pause_groups([T.userid() | String.t()], Map.t()) :: Map.t() + @spec pause_groups([T.userid() | String.t()], map()) :: map() defp pause_groups(group_ids, state) do # Drop the selected ids from any bucket values new_buckets = @@ -584,7 +584,7 @@ defmodule Teiserver.Game.QueueWaitServer do } end - @spec resume_paused_groups([T.userid() | String.t()], Map.t()) :: Map.t() + @spec resume_paused_groups([T.userid() | String.t()], map()) :: map() defp resume_paused_groups(group_ids, state) do groups = group_ids @@ -632,7 +632,7 @@ defmodule Teiserver.Game.QueueWaitServer do } end - @spec remove_paused_groups([T.userid() | String.t()], Map.t()) :: Map.t() + @spec remove_paused_groups([T.userid() | String.t()], map()) :: map() defp remove_paused_groups(group_ids, state) do new_paused_groups_map = state.paused_groups_map @@ -685,7 +685,7 @@ defmodule Teiserver.Game.QueueWaitServer do Enum.sum(wait_times) / (Enum.count(wait_times) + 1) end - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(opts) do :timer.send_interval(@default_telemetry_interval, self(), :telemetry_tick) :timer.send_interval(@update_interval, self(), :broadcast_update) diff --git a/lib/teiserver/helpers/schema_helper.ex b/lib/teiserver/helpers/schema_helper.ex index c3d79b35f..1d2677fe4 100644 --- a/lib/teiserver/helpers/schema_helper.ex +++ b/lib/teiserver/helpers/schema_helper.ex @@ -12,7 +12,7 @@ defmodule Teiserver.Helper.SchemaHelper do } end - @spec make_datetime(Datetime.t()) :: Map.t() + @spec make_datetime(Datetime.t()) :: map() defp make_datetime(d) do %{ "second" => Integer.to_string(d.second), @@ -24,7 +24,7 @@ defmodule Teiserver.Helper.SchemaHelper do } end - @spec parse_datetimes(Map.t(), List.t()) :: Map.t() + @spec parse_datetimes(map(), List.t()) :: map() def parse_datetimes(params, names) do names = Enum.map(names, fn n -> Atom.to_string(n) end) ++ names @@ -127,7 +127,7 @@ defmodule Teiserver.Helper.SchemaHelper do # |> Map.new # end - @spec trim_strings(Map.t(), List.t()) :: Map.t() + @spec trim_strings(map(), List.t()) :: map() def trim_strings(params, names) do names = Enum.map(names, fn n -> Atom.to_string(n) end) @@ -149,7 +149,7 @@ defmodule Teiserver.Helper.SchemaHelper do end) end - @spec min_and_max(Map.t(), [atom]) :: Map.t() + @spec min_and_max(map(), [atom]) :: map() def min_and_max(params, [field1, field2]) do field1 = Atom.to_string(field1) field2 = Atom.to_string(field2) @@ -167,7 +167,7 @@ defmodule Teiserver.Helper.SchemaHelper do Map.merge(params, mapped_values) end - @spec uniq_lists(Map.t(), List.t()) :: Map.t() + @spec uniq_lists(map(), List.t()) :: map() def uniq_lists(params, names) do names = Enum.map(names, fn n -> Atom.to_string(n) end) @@ -189,7 +189,7 @@ defmodule Teiserver.Helper.SchemaHelper do end) end - @spec remove_whitespace(Map.t(), List.t()) :: Map.t() + @spec remove_whitespace(map(), List.t()) :: map() def remove_whitespace(params, names) do names = Enum.map(names, fn n -> Atom.to_string(n) end) @@ -221,7 +221,7 @@ defmodule Teiserver.Helper.SchemaHelper do Given a list of fields and a list of patterns, will apply Regex.replace for every pattern to each field. """ - @spec remove_characters(Map.t(), List.t(), List.t()) :: Map.t() + @spec remove_characters(map(), List.t(), List.t()) :: map() def remove_characters(params, names, patterns) do names = Enum.map(names, fn n -> Atom.to_string(n) end) @@ -252,7 +252,7 @@ defmodule Teiserver.Helper.SchemaHelper do end) end - @spec safe_strings(Map.t(), List.t()) :: Map.t() + @spec safe_strings(map(), List.t()) :: map() def safe_strings(params, names) do names = Enum.map(names, fn n -> Atom.to_string(n) end) diff --git a/lib/teiserver/helpers/styling_helpers.ex b/lib/teiserver/helpers/styling_helpers.ex index b269c8909..90684ef41 100644 --- a/lib/teiserver/helpers/styling_helpers.ex +++ b/lib/teiserver/helpers/styling_helpers.ex @@ -223,7 +223,7 @@ defmodule Teiserver.Helper.StylingHelper do Enum.random(hex_colour_list()) end - @spec random_styling() :: Map.t() + @spec random_styling() :: map() def random_styling() do %{ "icon" => "fa-solid fa-" <> random_icon(), @@ -231,7 +231,7 @@ defmodule Teiserver.Helper.StylingHelper do } end - @spec random_styling(Map.t()) :: Map.t() + @spec random_styling(map()) :: map() def random_styling(input_dict) do Map.merge(random_styling(), input_dict) end diff --git a/lib/teiserver/lobby.ex b/lib/teiserver/lobby.ex index 27e93b610..8b3feb931 100644 --- a/lib/teiserver/lobby.ex +++ b/lib/teiserver/lobby.ex @@ -39,7 +39,7 @@ defmodule Teiserver.Lobby do ) end - @spec create_lobby(Map.t()) :: T.lobby() + @spec create_lobby(map()) :: T.lobby() def create_lobby(%{founder_id: _, founder_name: _, name: _} = lobby) do passworded = Map.get(lobby, :password) != nil @@ -397,7 +397,7 @@ defmodule Teiserver.Lobby do lobby_ids end - @spec find_empty_lobby(function()) :: Map.t() + @spec find_empty_lobby(function()) :: map() | nil def find_empty_lobby(filter_func \\ fn _ -> true end) do empties = stream_lobbies() @@ -649,7 +649,7 @@ defmodule Teiserver.Lobby do :ok end - @spec force_change_client(T.userid(), T.userid(), Map.t()) :: :ok + @spec force_change_client(T.userid(), T.userid(), map()) :: :ok def force_change_client(_, nil, _), do: nil def force_change_client(changer_id, client_id, new_values) do @@ -675,7 +675,7 @@ defmodule Teiserver.Lobby do end end - @spec change_client_battle_status(Map.t(), Map.t()) :: Map.t() + @spec change_client_battle_status(map(), map()) :: map() def change_client_battle_status(nil, _), do: nil def change_client_battle_status(_, values) when values == %{}, do: nil diff --git a/lib/teiserver/lobby/libs/command_lib.ex b/lib/teiserver/lobby/libs/command_lib.ex index 4afd33c5e..3bd23d4f1 100644 --- a/lib/teiserver/lobby/libs/command_lib.ex +++ b/lib/teiserver/lobby/libs/command_lib.ex @@ -83,7 +83,7 @@ defmodule Teiserver.Lobby.CommandLib do :ok end - @spec say_command(Map.t(), Map.t()) :: Map.t() + @spec say_command(map(), T.lobby_id()) :: any() def say_command(cmd = %{silent: true}, state), do: log_command(cmd, state) def say_command(cmd, lobby_id) do @@ -91,14 +91,14 @@ defmodule Teiserver.Lobby.CommandLib do Battle.say(cmd.userid, message, lobby_id) end - @spec log_command(map, T.lobby_id()) :: any + @spec log_command(map, T.lobby_id()) :: any() def log_command(cmd, lobby_id) do message = "$ " <> command_as_message(cmd) sender = Account.get_user_by_id(cmd.userid) ChatLib.persist_message(sender, message, lobby_id, :say) end - @spec command_as_message(Map.t()) :: String.t() + @spec command_as_message(map()) :: String.t() def command_as_message(cmd) do remaining = if Map.get(cmd, :remaining), do: " #{cmd.remaining}", else: "" error = if Map.get(cmd, :error), do: " Error: #{cmd.error}", else: "" diff --git a/lib/teiserver/lobby/servers/lobby_server.ex b/lib/teiserver/lobby/servers/lobby_server.ex index 03ed61523..a1ef01850 100644 --- a/lib/teiserver/lobby/servers/lobby_server.ex +++ b/lib/teiserver/lobby/servers/lobby_server.ex @@ -645,7 +645,7 @@ defmodule Teiserver.Battle.LobbyServer do end @impl true - @spec init(Map.t()) :: {:ok, Map.t()} + @spec init(map()) :: {:ok, map()} def init(%{lobby: %{id: id}} = data) do # Update the queue pids cache to point to this process Horde.Registry.register( diff --git a/lib/teiserver/logging.ex b/lib/teiserver/logging.ex index 7adcbf23a..0b3715d32 100644 --- a/lib/teiserver/logging.ex +++ b/lib/teiserver/logging.ex @@ -1785,17 +1785,17 @@ defmodule Teiserver.Logging do end # Delegated to helpers - @spec add_anonymous_audit_log(String.t(), Map.t()) :: Teiserver.Logging.AuditLog.t() + @spec add_anonymous_audit_log(String.t(), map()) :: Teiserver.Logging.AuditLog.t() defdelegate add_anonymous_audit_log(action, details), to: Teiserver.Logging.Helpers - @spec add_anonymous_audit_log(Plug.Conn.t(), String.t(), Map.t()) :: + @spec add_anonymous_audit_log(Plug.Conn.t(), String.t(), map()) :: Teiserver.Logging.AuditLog.t() defdelegate add_anonymous_audit_log(conn, action, details), to: Teiserver.Logging.Helpers - @spec add_audit_log(Plug.Conn.t(), String.t(), Map.t()) :: Teiserver.Logging.AuditLog.t() + @spec add_audit_log(Plug.Conn.t(), String.t(), map()) :: Teiserver.Logging.AuditLog.t() defdelegate add_audit_log(conn, action, details), to: Teiserver.Logging.Helpers - @spec add_audit_log(non_neg_integer(), String.t(), String.t(), Map.t()) :: + @spec add_audit_log(non_neg_integer(), String.t(), String.t(), map()) :: Teiserver.Logging.AuditLog.t() defdelegate add_audit_log(userid, ip, action, details), to: Teiserver.Logging.Helpers end diff --git a/lib/teiserver/logging/lib/logging_helpers.ex b/lib/teiserver/logging/lib/logging_helpers.ex index 297bd6047..85e74093f 100644 --- a/lib/teiserver/logging/lib/logging_helpers.ex +++ b/lib/teiserver/logging/lib/logging_helpers.ex @@ -3,7 +3,7 @@ defmodule Teiserver.Logging.Helpers do use Timex alias Teiserver.Logging - @spec add_anonymous_audit_log(String.t(), Map.t()) :: Teiserver.Logging.AuditLog.t() + @spec add_anonymous_audit_log(String.t(), map()) :: Teiserver.Logging.AuditLog.t() def add_anonymous_audit_log(action, details) do attrs = %{ user_id: nil, @@ -17,7 +17,7 @@ defmodule Teiserver.Logging.Helpers do the_log end - @spec add_anonymous_audit_log(Plug.Conn.t(), String.t(), Map.t()) :: + @spec add_anonymous_audit_log(Plug.Conn.t(), String.t(), map()) :: Teiserver.Logging.AuditLog.t() def add_anonymous_audit_log(conn, action, details) do attrs = %{ @@ -32,7 +32,7 @@ defmodule Teiserver.Logging.Helpers do the_log end - @spec add_audit_log(Plug.Conn.t() | Phoenix.LiveView.Socket.t(), String.t(), Map.t()) :: + @spec add_audit_log(Plug.Conn.t() | Phoenix.LiveView.Socket.t(), String.t(), map()) :: Teiserver.Logging.AuditLog.t() def add_audit_log(%Phoenix.LiveView.Socket{} = socket, action, details) do {:ok, the_log} = @@ -59,7 +59,7 @@ defmodule Teiserver.Logging.Helpers do the_log end - @spec add_audit_log(nil | non_neg_integer(), nil | String.t(), String.t(), Map.t()) :: + @spec add_audit_log(nil | non_neg_integer(), nil | String.t(), String.t(), map()) :: Teiserver.Logging.AuditLog.t() def add_audit_log(userid, ip, action, details) when is_integer(userid) do {:ok, the_log} = diff --git a/lib/teiserver/logging/schemas/match_day_log.ex b/lib/teiserver/logging/schemas/match_day_log.ex index 18409b108..90803532a 100644 --- a/lib/teiserver/logging/schemas/match_day_log.ex +++ b/lib/teiserver/logging/schemas/match_day_log.ex @@ -10,13 +10,13 @@ defmodule Teiserver.Logging.MatchDayLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, [:date, :data]) |> validate_required([:date, :data]) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/match_month_log.ex b/lib/teiserver/logging/schemas/match_month_log.ex index 197c729e3..c9d901196 100644 --- a/lib/teiserver/logging/schemas/match_month_log.ex +++ b/lib/teiserver/logging/schemas/match_month_log.ex @@ -11,13 +11,13 @@ defmodule Teiserver.Logging.MatchMonthLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, [:year, :month, :data]) |> validate_required([:year, :month, :data]) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/server_day_log.ex b/lib/teiserver/logging/schemas/server_day_log.ex index 6ad707d2b..ead2624da 100644 --- a/lib/teiserver/logging/schemas/server_day_log.ex +++ b/lib/teiserver/logging/schemas/server_day_log.ex @@ -10,13 +10,13 @@ defmodule Teiserver.Logging.ServerDayLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, [:date, :data]) |> validate_required([:date, :data]) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/server_minute_log.ex b/lib/teiserver/logging/schemas/server_minute_log.ex index 77dea9567..9f527a915 100644 --- a/lib/teiserver/logging/schemas/server_minute_log.ex +++ b/lib/teiserver/logging/schemas/server_minute_log.ex @@ -10,13 +10,13 @@ defmodule Teiserver.Logging.ServerMinuteLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, [:timestamp, :data]) |> validate_required([:timestamp, :data]) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/server_month_log.ex b/lib/teiserver/logging/schemas/server_month_log.ex index 21aad959b..fe4022783 100644 --- a/lib/teiserver/logging/schemas/server_month_log.ex +++ b/lib/teiserver/logging/schemas/server_month_log.ex @@ -12,13 +12,13 @@ defmodule Teiserver.Logging.ServerMonthLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(year month date data)a) |> validate_required(~w(year month date data)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/server_quarter_log.ex b/lib/teiserver/logging/schemas/server_quarter_log.ex index c92ff78c7..ca3b20acd 100644 --- a/lib/teiserver/logging/schemas/server_quarter_log.ex +++ b/lib/teiserver/logging/schemas/server_quarter_log.ex @@ -12,13 +12,13 @@ defmodule Teiserver.Logging.ServerQuarterLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(year quarter date data)a) |> validate_required(~w(year quarter date data)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/server_week_log.ex b/lib/teiserver/logging/schemas/server_week_log.ex index 3857e1439..469ae73b8 100644 --- a/lib/teiserver/logging/schemas/server_week_log.ex +++ b/lib/teiserver/logging/schemas/server_week_log.ex @@ -12,13 +12,13 @@ defmodule Teiserver.Logging.ServerWeekLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(year week date data)a) |> validate_required(~w(year week date data)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/server_year_log.ex b/lib/teiserver/logging/schemas/server_year_log.ex index a8481aae6..d58a026ff 100644 --- a/lib/teiserver/logging/schemas/server_year_log.ex +++ b/lib/teiserver/logging/schemas/server_year_log.ex @@ -11,13 +11,13 @@ defmodule Teiserver.Logging.ServerYearLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(year date data)a) |> validate_required(~w(year date data)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/logging/schemas/user_activity_day_log.ex b/lib/teiserver/logging/schemas/user_activity_day_log.ex index 1d04eda46..2899fe4fa 100644 --- a/lib/teiserver/logging/schemas/user_activity_day_log.ex +++ b/lib/teiserver/logging/schemas/user_activity_day_log.ex @@ -11,13 +11,13 @@ defmodule Teiserver.Logging.UserActivityDayLog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, [:date, :data]) |> validate_required([:date, :data]) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/microblog/schemas/post.ex b/lib/teiserver/microblog/schemas/post.ex index 7ba6b7b33..b9e353c05 100644 --- a/lib/teiserver/microblog/schemas/post.ex +++ b/lib/teiserver/microblog/schemas/post.ex @@ -25,7 +25,7 @@ defmodule Teiserver.Microblog.Post do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do tag_ids = params["tags"] || @@ -45,6 +45,6 @@ defmodule Teiserver.Microblog.Post do |> validate_required(~w(poster_id title contents)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Contributor") end diff --git a/lib/teiserver/microblog/schemas/post_tag.ex b/lib/teiserver/microblog/schemas/post_tag.ex index 3ae10363f..6332e5cdf 100644 --- a/lib/teiserver/microblog/schemas/post_tag.ex +++ b/lib/teiserver/microblog/schemas/post_tag.ex @@ -11,13 +11,13 @@ defmodule Teiserver.Microblog.PostTag do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(post_id tag_id)a) |> validate_required(~w(post_id tag_id)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/microblog/schemas/tag.ex b/lib/teiserver/microblog/schemas/tag.ex index eace9fb3f..29c0328b2 100644 --- a/lib/teiserver/microblog/schemas/tag.ex +++ b/lib/teiserver/microblog/schemas/tag.ex @@ -13,13 +13,13 @@ defmodule Teiserver.Microblog.Tag do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name colour icon)a) |> validate_required(~w(name colour icon)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/microblog/schemas/user_preference.ex b/lib/teiserver/microblog/schemas/user_preference.ex index e2d3a983e..c8c1aecf8 100644 --- a/lib/teiserver/microblog/schemas/user_preference.ex +++ b/lib/teiserver/microblog/schemas/user_preference.ex @@ -20,7 +20,7 @@ defmodule Teiserver.Microblog.UserPreference do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast( @@ -30,6 +30,6 @@ defmodule Teiserver.Microblog.UserPreference do |> validate_required(~w(user_id)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Contributor") end diff --git a/lib/teiserver/moderation.ex b/lib/teiserver/moderation.ex index f00bfae8a..3b3d36fb4 100644 --- a/lib/teiserver/moderation.ex +++ b/lib/teiserver/moderation.ex @@ -135,7 +135,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec create_report(Map.t()) :: {:ok, Report.t()} | {:error, Ecto.Changeset.t()} + @spec create_report(map()) :: {:ok, Report.t()} | {:error, Ecto.Changeset.t()} def create_report(attrs \\ %{}) do %Report{} |> Report.changeset(attrs) @@ -171,7 +171,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec update_report(Report.t(), Map.t()) :: {:ok, Report.t()} | {:error, Ecto.Changeset.t()} + @spec update_report(Report.t(), map()) :: {:ok, Report.t()} | {:error, Ecto.Changeset.t()} def update_report(%Report{} = report, attrs) do report |> Report.changeset(attrs) @@ -380,7 +380,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec create_response(Map.t()) :: {:ok, Response.t()} | {:error, Ecto.Changeset.t()} + @spec create_response(map()) :: {:ok, Response.t()} | {:error, Ecto.Changeset.t()} def create_response(attrs \\ %{}) do %Response{} |> Response.changeset(attrs) @@ -416,7 +416,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec update_response(Response.t(), Map.t()) :: + @spec update_response(Response.t(), map()) :: {:ok, Response.t()} | {:error, Ecto.Changeset.t()} def update_response(%Response{} = response, attrs) do response @@ -579,7 +579,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec create_action(Map.t()) :: {:ok, Action.t()} | {:error, Ecto.Changeset.t()} + @spec create_action(map()) :: {:ok, Action.t()} | {:error, Ecto.Changeset.t()} def create_action(attrs \\ %{}) do %Action{} |> Action.changeset(attrs) @@ -615,7 +615,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec update_action(Action.t(), Map.t()) :: {:ok, Action.t()} | {:error, Ecto.Changeset.t()} + @spec update_action(Action.t(), map()) :: {:ok, Action.t()} | {:error, Ecto.Changeset.t()} def update_action(%Action{} = action, attrs) do action |> Action.changeset(attrs) @@ -766,7 +766,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec create_proposal(Map.t()) :: {:ok, Proposal.t()} | {:error, Ecto.Changeset.t()} + @spec create_proposal(map()) :: {:ok, Proposal.t()} | {:error, Ecto.Changeset.t()} def create_proposal(attrs \\ %{}) do %Proposal{} |> Proposal.changeset(attrs) @@ -802,7 +802,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec update_proposal(Proposal.t(), Map.t()) :: + @spec update_proposal(Proposal.t(), map()) :: {:ok, Proposal.t()} | {:error, Ecto.Changeset.t()} def update_proposal(%Proposal{} = proposal, attrs) do proposal @@ -874,7 +874,7 @@ defmodule Teiserver.Moderation do nil """ - @spec get_proposal_vote(T.user_id(), integer()) :: ProposalVote.t() | nil + @spec get_proposal_vote(T.userid(), integer()) :: ProposalVote.t() | nil def get_proposal_vote(user_id, proposal_id) do ProposalVoteLib.query_proposal_votes() |> ProposalVoteLib.search(user_id: user_id, proposal_id: proposal_id) @@ -1029,7 +1029,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec create_ban(Map.t()) :: {:ok, Ban.t()} | {:error, Ecto.Changeset.t()} + @spec create_ban(map()) :: {:ok, Ban.t()} | {:error, Ecto.Changeset.t()} def create_ban(attrs \\ %{}) do %Ban{} |> Ban.changeset(attrs) @@ -1065,7 +1065,7 @@ defmodule Teiserver.Moderation do {:error, %Ecto.Changeset{}} """ - @spec update_ban(Ban.t(), Map.t()) :: {:ok, Ban.t()} | {:error, Ecto.Changeset.t()} + @spec update_ban(Ban.t(), map()) :: {:ok, Ban.t()} | {:error, Ecto.Changeset.t()} def update_ban(%Ban{} = ban, attrs) do ban |> Ban.changeset(attrs) diff --git a/lib/teiserver/moderation/libs/action_lib.ex b/lib/teiserver/moderation/libs/action_lib.ex index e077c8a6f..8b9c31e65 100644 --- a/lib/teiserver/moderation/libs/action_lib.ex +++ b/lib/teiserver/moderation/libs/action_lib.ex @@ -24,7 +24,7 @@ defmodule Teiserver.Moderation.ActionLib do def action_icon("Smurf"), do: "fa-solid fa-copy" - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(action) do %{ type_colour: colour(), @@ -44,7 +44,7 @@ defmodule Teiserver.Moderation.ActionLib do from(actions in Action) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/moderation/libs/ban_lib.ex b/lib/teiserver/moderation/libs/ban_lib.ex index 121648893..0bc6a01f7 100644 --- a/lib/teiserver/moderation/libs/ban_lib.ex +++ b/lib/teiserver/moderation/libs/ban_lib.ex @@ -10,7 +10,7 @@ defmodule Teiserver.Moderation.BanLib do @spec colour :: atom def colour, do: :danger - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(ban) do %{ type_colour: colour(), @@ -30,7 +30,7 @@ defmodule Teiserver.Moderation.BanLib do from(bans in Ban) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/moderation/libs/proposal_lib.ex b/lib/teiserver/moderation/libs/proposal_lib.ex index 949db2cd4..2a614b330 100644 --- a/lib/teiserver/moderation/libs/proposal_lib.ex +++ b/lib/teiserver/moderation/libs/proposal_lib.ex @@ -10,7 +10,7 @@ defmodule Teiserver.Moderation.ProposalLib do @spec colour :: atom def colour, do: :success - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(proposal) do %{ type_colour: colour(), @@ -30,7 +30,7 @@ defmodule Teiserver.Moderation.ProposalLib do from(proposals in Proposal) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/moderation/libs/proposal_vote_lib.ex b/lib/teiserver/moderation/libs/proposal_vote_lib.ex index 68585761a..b69c29294 100644 --- a/lib/teiserver/moderation/libs/proposal_vote_lib.ex +++ b/lib/teiserver/moderation/libs/proposal_vote_lib.ex @@ -9,7 +9,7 @@ defmodule Teiserver.Moderation.ProposalVoteLib do from(proposal_votes in ProposalVote) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), keyword() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/moderation/libs/report_group_lib.ex b/lib/teiserver/moderation/libs/report_group_lib.ex index 85e9c5e75..4a0976d7e 100644 --- a/lib/teiserver/moderation/libs/report_group_lib.ex +++ b/lib/teiserver/moderation/libs/report_group_lib.ex @@ -11,7 +11,7 @@ defmodule Teiserver.Moderation.ReportGroupLib do @spec icon() :: String.t() def icon(), do: "fa-house-flag" - @spec make_favourite(ReportGroup.t()) :: Map.t() + @spec make_favourite(ReportGroup.t()) :: map() def make_favourite(report_group) do %{ type_colour: Teiserver.Moderation.colour(), diff --git a/lib/teiserver/moderation/libs/report_lib.ex b/lib/teiserver/moderation/libs/report_lib.ex index 658dcccad..d6179553c 100644 --- a/lib/teiserver/moderation/libs/report_lib.ex +++ b/lib/teiserver/moderation/libs/report_lib.ex @@ -12,7 +12,7 @@ defmodule Teiserver.Moderation.ReportLib do def get_outstanding_report_max_days, do: 31 - @spec make_favourite(Map.t()) :: Map.t() + @spec make_favourite(map()) :: map() def make_favourite(report) do %{ type_colour: colour(), @@ -80,7 +80,7 @@ defmodule Teiserver.Moderation.ReportLib do from(reports in Report) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/moderation/libs/response_lib.ex b/lib/teiserver/moderation/libs/response_lib.ex index 3b44ebbb7..cdfbe67ed 100644 --- a/lib/teiserver/moderation/libs/response_lib.ex +++ b/lib/teiserver/moderation/libs/response_lib.ex @@ -27,7 +27,7 @@ defmodule Teiserver.Moderation.ResponseLib do from(responses in Response) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/moderation/schemas/action.ex b/lib/teiserver/moderation/schemas/action.ex index a71174309..af04bdb49 100644 --- a/lib/teiserver/moderation/schemas/action.ex +++ b/lib/teiserver/moderation/schemas/action.ex @@ -21,7 +21,7 @@ defmodule Teiserver.Moderation.Action do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -53,7 +53,7 @@ defmodule Teiserver.Moderation.Action do Ecto.Changeset.put_change(struct, :restrictions, new_restrictions) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Overwatch") def authorize(:search, conn, _), do: allow?(conn, "Overwatch") def authorize(:show, conn, _), do: allow?(conn, "Overwatch") diff --git a/lib/teiserver/moderation/schemas/ban.ex b/lib/teiserver/moderation/schemas/ban.ex index d99fe4a31..5e19fab19 100644 --- a/lib/teiserver/moderation/schemas/ban.ex +++ b/lib/teiserver/moderation/schemas/ban.ex @@ -13,7 +13,7 @@ defmodule Teiserver.Moderation.Ban do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -24,7 +24,7 @@ defmodule Teiserver.Moderation.Ban do |> validate_required(~w(source_id added_by_id key_values enabled reason)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Overwatch") def authorize(:show, conn, _), do: allow?(conn, "Reviewer") def authorize(_, conn, _), do: allow?(conn, "Moderator") diff --git a/lib/teiserver/moderation/schemas/proposal.ex b/lib/teiserver/moderation/schemas/proposal.ex index 17bbae879..1f9a24a63 100644 --- a/lib/teiserver/moderation/schemas/proposal.ex +++ b/lib/teiserver/moderation/schemas/proposal.ex @@ -23,7 +23,7 @@ defmodule Teiserver.Moderation.Proposal do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -41,7 +41,7 @@ defmodule Teiserver.Moderation.Proposal do |> validate_length(:restrictions, min: 1) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:conclude, conn, _), do: allow?(conn, "Moderator") def authorize(_, conn, _), do: allow?(conn, "Overwatch") end diff --git a/lib/teiserver/moderation/schemas/proposal_vote.ex b/lib/teiserver/moderation/schemas/proposal_vote.ex index d4296f1d0..df56146b3 100644 --- a/lib/teiserver/moderation/schemas/proposal_vote.ex +++ b/lib/teiserver/moderation/schemas/proposal_vote.ex @@ -12,7 +12,7 @@ defmodule Teiserver.Moderation.ProposalVote do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(vote user_id proposal_id)a) diff --git a/lib/teiserver/moderation/schemas/report.ex b/lib/teiserver/moderation/schemas/report.ex index 150500ad0..f0e3d0cd1 100644 --- a/lib/teiserver/moderation/schemas/report.ex +++ b/lib/teiserver/moderation/schemas/report.ex @@ -21,7 +21,7 @@ defmodule Teiserver.Moderation.Report do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -35,7 +35,7 @@ defmodule Teiserver.Moderation.Report do |> validate_required(~w(reporter_id target_id type sub_type closed)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Overwatch") def authorize(:search, conn, _), do: allow?(conn, "Overwatch") def authorize(:show, conn, _), do: allow?(conn, "Overwatch") diff --git a/lib/teiserver/moderation/schemas/report_group.ex b/lib/teiserver/moderation/schemas/report_group.ex index 8d813eb68..a10d54007 100644 --- a/lib/teiserver/moderation/schemas/report_group.ex +++ b/lib/teiserver/moderation/schemas/report_group.ex @@ -19,7 +19,7 @@ defmodule Teiserver.Moderation.ReportGroup do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast( @@ -29,7 +29,7 @@ defmodule Teiserver.Moderation.ReportGroup do |> validate_required(~w(target_id)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Overwatch") def authorize(:search, conn, _), do: allow?(conn, "Overwatch") def authorize(:show, conn, _), do: allow?(conn, "Overwatch") diff --git a/lib/teiserver/moderation/schemas/report_group_message.ex b/lib/teiserver/moderation/schemas/report_group_message.ex index 8ac89d694..7a144ad4c 100644 --- a/lib/teiserver/moderation/schemas/report_group_message.ex +++ b/lib/teiserver/moderation/schemas/report_group_message.ex @@ -11,7 +11,7 @@ defmodule Teiserver.Moderation.ReportGroupMessage do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -25,7 +25,7 @@ defmodule Teiserver.Moderation.ReportGroupMessage do |> validate_required(~w(report_group_id user_id content)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Overwatch") def authorize(:search, conn, _), do: allow?(conn, "Overwatch") def authorize(:show, conn, _), do: allow?(conn, "Overwatch") diff --git a/lib/teiserver/moderation/schemas/report_group_vote.ex b/lib/teiserver/moderation/schemas/report_group_vote.ex index bedd4291a..b6169853f 100644 --- a/lib/teiserver/moderation/schemas/report_group_vote.ex +++ b/lib/teiserver/moderation/schemas/report_group_vote.ex @@ -12,7 +12,7 @@ defmodule Teiserver.Moderation.ReportGroupVote do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do params = params @@ -26,7 +26,7 @@ defmodule Teiserver.Moderation.ReportGroupVote do |> validate_required(~w(report_group_id user_id action accuracy)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Overwatch") def authorize(:search, conn, _), do: allow?(conn, "Overwatch") def authorize(:show, conn, _), do: allow?(conn, "Overwatch") diff --git a/lib/teiserver/moderation/schemas/response.ex b/lib/teiserver/moderation/schemas/response.ex index 2d99fc7bd..84e940e74 100644 --- a/lib/teiserver/moderation/schemas/response.ex +++ b/lib/teiserver/moderation/schemas/response.ex @@ -13,7 +13,7 @@ defmodule Teiserver.Moderation.Response do timestamps() end - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast( @@ -23,7 +23,7 @@ defmodule Teiserver.Moderation.Response do |> validate_required(~w(report_id user_id action accurate)a) end - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(:index, conn, _), do: allow?(conn, "Overwatch") def authorize(:search, conn, _), do: allow?(conn, "Overwatch") def authorize(:show, conn, _), do: allow?(conn, "Overwatch") diff --git a/lib/teiserver/protocols/spring/spring.ex b/lib/teiserver/protocols/spring/spring.ex index ab55162a2..c05c0d75c 100644 --- a/lib/teiserver/protocols/spring/spring.ex +++ b/lib/teiserver/protocols/spring/spring.ex @@ -10,7 +10,7 @@ defmodule Teiserver.Protocols.Spring do @spec protocol_out :: Teiserver.Protocols.SpringOut def protocol_out(), do: SpringOut - @spec parse_client_status(String.t()) :: Map.t() + @spec parse_client_status(String.t()) :: map() def parse_client_status(status_str) do status_bits = BitParse.parse_bits(status_str, 7) @@ -27,7 +27,7 @@ defmodule Teiserver.Protocols.Spring do } end - @spec create_client_status(Map.t()) :: Integer.t() + @spec create_client_status(map()) :: Integer.t() def create_client_status(client) do [r1, r2, r3] = BitParse.parse_bits("#{client.rank || 1}", 3) @@ -54,7 +54,7 @@ defmodule Teiserver.Protocols.Spring do # b22..b23 = sync status (0 = unknown, 1 = synced, 2 = unsynced) # b24..b27 = side (e.g.: arm, core, tll, ... Side index can be between 0 and 15, inclusive) # b28..b31 = undefined (reserved for future use) Experimental: Use these for ally team no. extension (16->256) - @spec parse_battle_status(String.t()) :: Map.t() + @spec parse_battle_status(String.t()) :: map() def parse_battle_status(status) do status_bits = BitParse.parse_bits(status, 32) @@ -138,7 +138,7 @@ defmodule Teiserver.Protocols.Spring do } end - @spec create_battle_status(Map.t()) :: Integer.t() + @spec create_battle_status(map()) :: Integer.t() def create_battle_status(client) do sync_value = Map.get(client, :sync, %{}) diff --git a/lib/teiserver/protocols/spring/spring_auth_in.ex b/lib/teiserver/protocols/spring/spring_auth_in.ex index 6a8d4a89f..1bdb7d6cb 100644 --- a/lib/teiserver/protocols/spring/spring_auth_in.ex +++ b/lib/teiserver/protocols/spring/spring_auth_in.ex @@ -6,7 +6,7 @@ defmodule Teiserver.Protocols.Spring.AuthIn do import Teiserver.Protocols.SpringOut, only: [reply: 5] require Logger - @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() + @spec do_handle(String.t(), String.t(), String.t() | nil, map()) :: map() def do_handle("login_queue_heartbeat", _, _msg_id, %{queued_userid: nil} = state) do state end diff --git a/lib/teiserver/protocols/spring/spring_battle_in.ex b/lib/teiserver/protocols/spring/spring_battle_in.ex index f3c81878e..7c06d8cfc 100644 --- a/lib/teiserver/protocols/spring/spring_battle_in.ex +++ b/lib/teiserver/protocols/spring/spring_battle_in.ex @@ -5,7 +5,7 @@ defmodule Teiserver.Protocols.Spring.BattleIn do import Teiserver.Helper.NumberHelper, only: [int_parse: 1] require Logger - @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() + @spec do_handle(String.t(), String.t(), String.t() | nil, map()) :: map() def do_handle("update_lobby_title", new_name, msg_id, state) do if Lobby.allow?(state.userid, :update_lobby_title, state.lobby_id) do Battle.rename_lobby(state.lobby_id, new_name, nil) diff --git a/lib/teiserver/protocols/spring/spring_in.ex b/lib/teiserver/protocols/spring/spring_in.ex index f67d5196f..e9ba49ac2 100644 --- a/lib/teiserver/protocols/spring/spring_in.ex +++ b/lib/teiserver/protocols/spring/spring_in.ex @@ -36,7 +36,7 @@ defmodule Teiserver.Protocols.SpringIn do @action_commands ~w(SAY SAYEX SAYPRIVATE SAYBATTLE SAYBATTLEPRIVATEEX JOINBATTLE LEAVEBATTLE) - @spec data_in(String.t(), Map.t()) :: Map.t() + @spec data_in(String.t(), map()) :: map() def data_in(data, state) do if Application.get_env(:teiserver, Teiserver)[:extra_logging] == true or state.print_client_messages do @@ -1358,7 +1358,7 @@ defmodule Teiserver.Protocols.SpringIn do _no_match(state, cmd, msg_id, data) end - @spec _no_match(Map.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() + @spec _no_match(map(), String.t(), String.t() | nil, String.t()) :: map() def _no_match(state, cmd, msg_id, data) do data = data diff --git a/lib/teiserver/protocols/spring/spring_lobby_policy_in.ex b/lib/teiserver/protocols/spring/spring_lobby_policy_in.ex index d6eed2e4f..f16b63c52 100644 --- a/lib/teiserver/protocols/spring/spring_lobby_policy_in.ex +++ b/lib/teiserver/protocols/spring/spring_lobby_policy_in.ex @@ -4,7 +4,7 @@ defmodule Teiserver.Protocols.Spring.LobbyPolicyIn do import Teiserver.Protocols.SpringOut, only: [reply: 5] require Logger - @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() + @spec do_handle(String.t(), String.t(), String.t() | nil, map()) :: map() def do_handle(_, _, _, %{userid: nil} = state), do: state def do_handle("list", _, msg_id, state) do diff --git a/lib/teiserver/protocols/spring/spring_matchmaking_in.ex b/lib/teiserver/protocols/spring/spring_matchmaking_in.ex index 418d556db..fc1d1b41d 100644 --- a/lib/teiserver/protocols/spring/spring_matchmaking_in.ex +++ b/lib/teiserver/protocols/spring/spring_matchmaking_in.ex @@ -5,7 +5,7 @@ # import Teiserver.Helper.NumberHelper, only: [int_parse: 1] # require Logger -# @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() +# @spec do_handle(String.t(), String.t(), String.t() | nil, map()) :: map() # def do_handle("list_all_queues", _, msg_id, state) do # queues = Matchmaking.list_queues() # reply(:matchmaking, :full_queue_list, queues, msg_id, state) diff --git a/lib/teiserver/protocols/spring/spring_system_in.ex b/lib/teiserver/protocols/spring/spring_system_in.ex index c83271e6e..1ac40177c 100644 --- a/lib/teiserver/protocols/spring/spring_system_in.ex +++ b/lib/teiserver/protocols/spring/spring_system_in.ex @@ -4,7 +4,7 @@ defmodule Teiserver.Protocols.Spring.SystemIn do alias Teiserver.Protocols.SpringIn require Logger - @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() + @spec do_handle(String.t(), String.t(), String.t() | nil, map()) :: map() # def do_handle("command", _, _msg_id, state) do # state # end diff --git a/lib/teiserver/protocols/spring/spring_telemetry_in.ex b/lib/teiserver/protocols/spring/spring_telemetry_in.ex index 97f5fd972..da086e2ca 100644 --- a/lib/teiserver/protocols/spring/spring_telemetry_in.ex +++ b/lib/teiserver/protocols/spring/spring_telemetry_in.ex @@ -7,7 +7,7 @@ defmodule Teiserver.Protocols.Spring.TelemetryIn do # import Teiserver.Helper.NumberHelper, only: [int_parse: 1] # TODO: Less nested hackyness - @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() + @spec do_handle(String.t(), String.t(), String.t() | nil, map()) :: map() def do_handle("upload_infolog", data, msg_id, state) do case Regex.run(~r/(\S+) (\S+) (\S+) (\S+)/u, data) do [_, log_type, user_hash, metadata64, contents64] -> diff --git a/lib/teiserver/protocols/spring/spring_user_in.ex b/lib/teiserver/protocols/spring/spring_user_in.ex index 10e995547..5bca82053 100644 --- a/lib/teiserver/protocols/spring/spring_user_in.ex +++ b/lib/teiserver/protocols/spring/spring_user_in.ex @@ -6,7 +6,7 @@ defmodule Teiserver.Protocols.Spring.UserIn do import Teiserver.Helper.NumberHelper, only: [int_parse: 1] require Logger - @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() + @spec do_handle(String.t(), String.t(), String.t() | nil, map()) :: map() def do_handle("add_friend", userids_str, msg_id, state) do responses = userids_str diff --git a/lib/teiserver/servers/telemetry_server.ex b/lib/teiserver/servers/telemetry_server.ex index e67c24146..f8e42aa58 100644 --- a/lib/teiserver/servers/telemetry_server.ex +++ b/lib/teiserver/servers/telemetry_server.ex @@ -77,7 +77,7 @@ defmodule Teiserver.Telemetry.TelemetryServer do {:reply, get_totals(state), @default_state} end - @spec report_telemetry(Map.t()) :: :ok + @spec report_telemetry(map()) :: :ok defp report_telemetry(state) do client = @client_states @@ -122,7 +122,7 @@ defmodule Teiserver.Telemetry.TelemetryServer do ) end - @spec get_totals(Map.t()) :: Map.t() + @spec get_totals(map()) :: map() defp get_totals(state) do battles = Lobby.list_lobbies() client_ids = Client.list_client_ids() diff --git a/lib/teiserver/tcp/spring/spring_tcp_server.ex b/lib/teiserver/tcp/spring/spring_tcp_server.ex index ecc6d80b0..b6df4075d 100644 --- a/lib/teiserver/tcp/spring/spring_tcp_server.ex +++ b/lib/teiserver/tcp/spring/spring_tcp_server.ex @@ -1331,7 +1331,7 @@ defmodule Teiserver.SpringTcpServer do # Example of how gen-smtp handles upgrading the connection # https://github.com/gen-smtp/gen_smtp/blob/master/src/gen_smtp_server_session.erl#L683-L720 - @spec upgrade_connection(Map.t()) :: Map.t() + @spec upgrade_connection(map()) :: map() def upgrade_connection(state) do :ok = state.transport.setopts(state.socket, [{:active, false}]) diff --git a/lib/teiserver/telemetry.ex b/lib/teiserver/telemetry.ex index 07c32ce9e..43aadc4fe 100644 --- a/lib/teiserver/telemetry.ex +++ b/lib/teiserver/telemetry.ex @@ -957,7 +957,7 @@ defmodule Teiserver.Telemetry do {:error, %Ecto.Changeset{}} """ - @spec create_infolog(Map.t()) :: {:ok, Infolog.t()} | {:error, Ecto.Changeset.t()} + @spec create_infolog(map()) :: {:ok, Infolog.t()} | {:error, Ecto.Changeset.t()} def create_infolog(attrs \\ %{}) do %Infolog{} |> Infolog.changeset(attrs) diff --git a/lib/teiserver/telemetry/libs/infolog_lib.ex b/lib/teiserver/telemetry/libs/infolog_lib.ex index e8df8ba0a..489f79792 100644 --- a/lib/teiserver/telemetry/libs/infolog_lib.ex +++ b/lib/teiserver/telemetry/libs/infolog_lib.ex @@ -16,7 +16,7 @@ defmodule Teiserver.Telemetry.InfologLib do from(infologs in Infolog) end - @spec search(Ecto.Query.t(), Map.t() | nil) :: Ecto.Query.t() + @spec search(Ecto.Query.t(), map() | nil) :: Ecto.Query.t() def search(query, nil), do: query def search(query, params) do diff --git a/lib/teiserver/telemetry/schemas/anon_property.ex b/lib/teiserver/telemetry/schemas/anon_property.ex index 0595414bd..90030ecf1 100644 --- a/lib/teiserver/telemetry/schemas/anon_property.ex +++ b/lib/teiserver/telemetry/schemas/anon_property.ex @@ -14,13 +14,13 @@ defmodule Teiserver.Telemetry.AnonProperty do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(property_type_id last_updated value hash)a) |> validate_required(~w(property_type_id last_updated value hash)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_anon_event.ex b/lib/teiserver/telemetry/schemas/complex_anon_event.ex index deab1ba6c..c534de97c 100644 --- a/lib/teiserver/telemetry/schemas/complex_anon_event.ex +++ b/lib/teiserver/telemetry/schemas/complex_anon_event.ex @@ -13,13 +13,13 @@ defmodule Teiserver.Telemetry.ComplexAnonEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(hash event_type_id timestamp value)a) |> validate_required(~w(hash event_type_id timestamp value)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_client_event.ex b/lib/teiserver/telemetry/schemas/complex_client_event.ex index 5341618b9..674552acb 100644 --- a/lib/teiserver/telemetry/schemas/complex_client_event.ex +++ b/lib/teiserver/telemetry/schemas/complex_client_event.ex @@ -13,13 +13,13 @@ defmodule Teiserver.Telemetry.ComplexClientEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id event_type_id timestamp value)a) |> validate_required(~w(user_id event_type_id timestamp value)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_client_event_type.ex b/lib/teiserver/telemetry/schemas/complex_client_event_type.ex index db587a65e..ebb9568cf 100644 --- a/lib/teiserver/telemetry/schemas/complex_client_event_type.ex +++ b/lib/teiserver/telemetry/schemas/complex_client_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.ComplexClientEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_lobby_event.ex b/lib/teiserver/telemetry/schemas/complex_lobby_event.ex index 0ca5907da..7e45c9847 100644 --- a/lib/teiserver/telemetry/schemas/complex_lobby_event.ex +++ b/lib/teiserver/telemetry/schemas/complex_lobby_event.ex @@ -13,13 +13,13 @@ defmodule Teiserver.Telemetry.ComplexLobbyEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id event_type_id match_id timestamp value)a) |> validate_required(~w(event_type_id timestamp)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_lobby_event_type.ex b/lib/teiserver/telemetry/schemas/complex_lobby_event_type.ex index c6b815319..dfd4f9f9b 100644 --- a/lib/teiserver/telemetry/schemas/complex_lobby_event_type.ex +++ b/lib/teiserver/telemetry/schemas/complex_lobby_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.ComplexLobbyEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_match_event.ex b/lib/teiserver/telemetry/schemas/complex_match_event.ex index ee32669c6..41c3da4ff 100644 --- a/lib/teiserver/telemetry/schemas/complex_match_event.ex +++ b/lib/teiserver/telemetry/schemas/complex_match_event.ex @@ -14,13 +14,13 @@ defmodule Teiserver.Telemetry.ComplexMatchEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id match_id event_type_id value game_time)a) |> validate_required(~w(match_id event_type_id value game_time)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_match_event_type.ex b/lib/teiserver/telemetry/schemas/complex_match_event_type.ex index 604c61ad5..ccc226e02 100644 --- a/lib/teiserver/telemetry/schemas/complex_match_event_type.ex +++ b/lib/teiserver/telemetry/schemas/complex_match_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.ComplexMatchEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_server_event.ex b/lib/teiserver/telemetry/schemas/complex_server_event.ex index 2ca6265b0..39458c553 100644 --- a/lib/teiserver/telemetry/schemas/complex_server_event.ex +++ b/lib/teiserver/telemetry/schemas/complex_server_event.ex @@ -13,13 +13,13 @@ defmodule Teiserver.Telemetry.ComplexServerEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id event_type_id timestamp value)a) |> validate_required(~w(event_type_id timestamp value)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/complex_server_event_type.ex b/lib/teiserver/telemetry/schemas/complex_server_event_type.ex index 64689c1f9..3ffb17bf2 100644 --- a/lib/teiserver/telemetry/schemas/complex_server_event_type.ex +++ b/lib/teiserver/telemetry/schemas/complex_server_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.ComplexServerEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/infolog.ex b/lib/teiserver/telemetry/schemas/infolog.ex index 1fede7b53..22ceefe43 100644 --- a/lib/teiserver/telemetry/schemas/infolog.ex +++ b/lib/teiserver/telemetry/schemas/infolog.ex @@ -16,13 +16,13 @@ defmodule Teiserver.Telemetry.Infolog do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_hash user_id log_type timestamp metadata contents size)a) |> validate_required(~w(user_hash log_type timestamp metadata contents size)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Engine") end diff --git a/lib/teiserver/telemetry/schemas/property_types.ex b/lib/teiserver/telemetry/schemas/property_types.ex index b89653734..20bff2a08 100644 --- a/lib/teiserver/telemetry/schemas/property_types.ex +++ b/lib/teiserver/telemetry/schemas/property_types.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.PropertyType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_anon_event.ex b/lib/teiserver/telemetry/schemas/simple_anon_event.ex index 505997c32..11736d6e6 100644 --- a/lib/teiserver/telemetry/schemas/simple_anon_event.ex +++ b/lib/teiserver/telemetry/schemas/simple_anon_event.ex @@ -11,13 +11,13 @@ defmodule Teiserver.Telemetry.SimpleAnonEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(hash event_type_id timestamp)a) |> validate_required(~w(hash event_type_id timestamp)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_client_event.ex b/lib/teiserver/telemetry/schemas/simple_client_event.ex index b4733f8c6..5944ed22e 100644 --- a/lib/teiserver/telemetry/schemas/simple_client_event.ex +++ b/lib/teiserver/telemetry/schemas/simple_client_event.ex @@ -11,13 +11,13 @@ defmodule Teiserver.Telemetry.SimpleClientEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id event_type_id timestamp)a) |> validate_required(~w(user_id event_type_id timestamp)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_client_event_type.ex b/lib/teiserver/telemetry/schemas/simple_client_event_type.ex index fc036fb84..9d8e3e2d8 100644 --- a/lib/teiserver/telemetry/schemas/simple_client_event_type.ex +++ b/lib/teiserver/telemetry/schemas/simple_client_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.SimpleClientEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_lobby_event.ex b/lib/teiserver/telemetry/schemas/simple_lobby_event.ex index c21969897..561361125 100644 --- a/lib/teiserver/telemetry/schemas/simple_lobby_event.ex +++ b/lib/teiserver/telemetry/schemas/simple_lobby_event.ex @@ -12,13 +12,13 @@ defmodule Teiserver.Telemetry.SimpleLobbyEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id event_type_id match_id timestamp)a) |> validate_required(~w(event_type_id timestamp)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_lobby_event_type.ex b/lib/teiserver/telemetry/schemas/simple_lobby_event_type.ex index 97d000a00..2c84ab8bc 100644 --- a/lib/teiserver/telemetry/schemas/simple_lobby_event_type.ex +++ b/lib/teiserver/telemetry/schemas/simple_lobby_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.SimpleLobbyEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_match_event.ex b/lib/teiserver/telemetry/schemas/simple_match_event.ex index 730e394eb..aeaa6199b 100644 --- a/lib/teiserver/telemetry/schemas/simple_match_event.ex +++ b/lib/teiserver/telemetry/schemas/simple_match_event.ex @@ -13,13 +13,13 @@ defmodule Teiserver.Telemetry.SimpleMatchEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id match_id event_type_id game_time)a) |> validate_required(~w(match_id event_type_id game_time)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_match_event_type.ex b/lib/teiserver/telemetry/schemas/simple_match_event_type.ex index 6fb463998..f37e9c3dd 100644 --- a/lib/teiserver/telemetry/schemas/simple_match_event_type.ex +++ b/lib/teiserver/telemetry/schemas/simple_match_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.SimpleMatchEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_server_event.ex b/lib/teiserver/telemetry/schemas/simple_server_event.ex index cf7a69d3a..0d53916c3 100644 --- a/lib/teiserver/telemetry/schemas/simple_server_event.ex +++ b/lib/teiserver/telemetry/schemas/simple_server_event.ex @@ -11,13 +11,13 @@ defmodule Teiserver.Telemetry.SimpleServerEvent do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id event_type_id timestamp)a) |> validate_required(~w(event_type_id timestamp)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/simple_server_event_type.ex b/lib/teiserver/telemetry/schemas/simple_server_event_type.ex index 549adc88a..962f838aa 100644 --- a/lib/teiserver/telemetry/schemas/simple_server_event_type.ex +++ b/lib/teiserver/telemetry/schemas/simple_server_event_type.ex @@ -9,13 +9,13 @@ defmodule Teiserver.Telemetry.SimpleServerEventType do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(name)a) |> validate_required(~w(name)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver/telemetry/schemas/user_property.ex b/lib/teiserver/telemetry/schemas/user_property.ex index b50ec41b5..0327ca2ae 100644 --- a/lib/teiserver/telemetry/schemas/user_property.ex +++ b/lib/teiserver/telemetry/schemas/user_property.ex @@ -14,13 +14,13 @@ defmodule Teiserver.Telemetry.UserProperty do @doc """ Builds a changeset based on the `struct` and `params`. """ - @spec changeset(Map.t(), Map.t()) :: Ecto.Changeset.t() + @spec changeset(map(), map()) :: Ecto.Changeset.t() def changeset(struct, params \\ %{}) do struct |> cast(params, ~w(user_id property_type_id last_updated value)a) |> validate_required(~w(user_id property_type_id last_updated value)a) end - @spec authorize(atom, Plug.Conn.t(), Map.t()) :: boolean + @spec authorize(atom, Plug.Conn.t(), map()) :: boolean def authorize(_action, conn, _params), do: allow?(conn, "Server") end diff --git a/lib/teiserver_web/components/core_components.ex b/lib/teiserver_web/components/core_components.ex index 5f0098bf4..6e33049a1 100644 --- a/lib/teiserver_web/components/core_components.ex +++ b/lib/teiserver_web/components/core_components.ex @@ -5,7 +5,7 @@ defmodule TeiserverWeb.CoreComponents do use Phoenix.Component alias Phoenix.LiveView.JS - import TeiserverWeb.Gettext + use Gettext, backend: TeiserverWeb.Gettext alias Fontawesome @doc """ diff --git a/lib/teiserver_web/controllers/account/general_controller.ex b/lib/teiserver_web/controllers/account/general_controller.ex index 125444f95..1e77269ce 100644 --- a/lib/teiserver_web/controllers/account/general_controller.ex +++ b/lib/teiserver_web/controllers/account/general_controller.ex @@ -4,7 +4,7 @@ defmodule TeiserverWeb.Account.GeneralController do alias Teiserver.Account - plug(:add_breadcrumb, name: 'Account', url: '/teiserver/account') + plug(:add_breadcrumb, name: "Account", url: "/teiserver/account") plug(AssignPlug, site_menu_active: "teiserver_account", diff --git a/lib/teiserver_web/controllers/account/security_controller.ex b/lib/teiserver_web/controllers/account/security_controller.ex index 4606ae0dc..47dd60281 100644 --- a/lib/teiserver_web/controllers/account/security_controller.ex +++ b/lib/teiserver_web/controllers/account/security_controller.ex @@ -3,8 +3,8 @@ defmodule TeiserverWeb.Account.SecurityController do alias Teiserver.Account - plug(:add_breadcrumb, name: 'Account', url: '/teiserver/account') - plug(:add_breadcrumb, name: 'Security', url: '/teiserver/account/security') + plug(:add_breadcrumb, name: "Account", url: "/teiserver/account") + plug(:add_breadcrumb, name: "Security", url: "/teiserver/account/security") plug(AssignPlug, site_menu_active: "teiserver_account", @@ -56,7 +56,7 @@ defmodule TeiserverWeb.Account.SecurityController do end end - @spec delete_token(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete_token(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete_token(conn, %{"id" => id}) do token = Account.get_user_token(id, diff --git a/lib/teiserver_web/controllers/account/session_controller.ex b/lib/teiserver_web/controllers/account/session_controller.ex index aaa722034..ebbacc672 100644 --- a/lib/teiserver_web/controllers/account/session_controller.ex +++ b/lib/teiserver_web/controllers/account/session_controller.ex @@ -6,7 +6,7 @@ defmodule TeiserverWeb.Account.SessionController do alias Account.{Guardian, User, UserLib} require Logger - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _) do changeset = Account.change_user(%User{}) maybe_user = Guardian.Plug.current_resource(conn) @@ -29,7 +29,7 @@ defmodule TeiserverWeb.Account.SessionController do end end - @spec login(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec login(Plug.Conn.t(), map()) :: Plug.Conn.t() def login(conn, %{"user" => %{"email" => email, "password" => password}}) do email = String.trim(email) @@ -84,7 +84,7 @@ defmodule TeiserverWeb.Account.SessionController do end end - @spec logout(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec logout(Plug.Conn.t(), map()) :: Plug.Conn.t() def logout(conn, _) do conn |> Guardian.Plug.sign_out(clear_remember_me: true) @@ -118,7 +118,7 @@ defmodule TeiserverWeb.Account.SessionController do |> render("result.html") end - @spec forgot_password(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec forgot_password(Plug.Conn.t(), map()) :: Plug.Conn.t() def forgot_password(conn, _params) do key = UUID.uuid1() value = UUID.uuid1() @@ -130,7 +130,7 @@ defmodule TeiserverWeb.Account.SessionController do |> render("forgot_password.html") end - @spec send_password_reset(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec send_password_reset(Plug.Conn.t(), map()) :: Plug.Conn.t() def send_password_reset(conn, %{"email" => email} = params) do # We use the || %{} to allow for the user not existing # If we let user be nil it messes up the existing_resets @@ -217,7 +217,7 @@ defmodule TeiserverWeb.Account.SessionController do end end - @spec password_reset_form(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec password_reset_form(Plug.Conn.t(), map()) :: Plug.Conn.t() def password_reset_form(conn, %{"value" => value}) do code = Account.get_code(value, preload: [:user]) @@ -247,7 +247,7 @@ defmodule TeiserverWeb.Account.SessionController do end end - @spec password_reset_post(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec password_reset_post(Plug.Conn.t(), map()) :: Plug.Conn.t() def password_reset_post(conn, %{"value" => value, "pass1" => pass1, "pass2" => pass2}) do code = Account.get_code(value, preload: [:user]) diff --git a/lib/teiserver_web/controllers/admin/accolade_controller.ex b/lib/teiserver_web/controllers/admin/accolade_controller.ex index 005ed1ec2..943dd390e 100644 --- a/lib/teiserver_web/controllers/admin/accolade_controller.ex +++ b/lib/teiserver_web/controllers/admin/accolade_controller.ex @@ -15,10 +15,10 @@ defmodule TeiserverWeb.Admin.AccoladeController do sub_menu_active: "accolade" ) - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Accolades', url: '/teiserver/admin/accolades' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Accolades", url: "/teiserver/admin/accolades" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do accolades = Account.list_accolades( @@ -39,7 +39,7 @@ defmodule TeiserverWeb.Admin.AccoladeController do |> render("index.html") end - @spec user_show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec user_show(Plug.Conn.t(), map()) :: Plug.Conn.t() def user_show(conn, %{"user_id" => user_id} = params) do accolades = Account.list_accolades( @@ -65,7 +65,7 @@ defmodule TeiserverWeb.Admin.AccoladeController do |> render("user_index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do accolade = Account.get_accolade!(id, @@ -82,7 +82,7 @@ defmodule TeiserverWeb.Admin.AccoladeController do |> render("show.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Account.change_accolade(%Accolade{}) @@ -92,7 +92,7 @@ defmodule TeiserverWeb.Admin.AccoladeController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"accolade" => accolade_params}) do case Account.create_accolade(accolade_params) do {:ok, _accolade} -> @@ -107,7 +107,7 @@ defmodule TeiserverWeb.Admin.AccoladeController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do accolade = Account.get_accolade!(id) @@ -120,7 +120,7 @@ defmodule TeiserverWeb.Admin.AccoladeController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "accolade" => accolade_params}) do accolade = Account.get_accolade!(id) @@ -138,7 +138,7 @@ defmodule TeiserverWeb.Admin.AccoladeController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do accolade = Account.get_accolade!(id) diff --git a/lib/teiserver_web/controllers/admin/achievement_controller.ex b/lib/teiserver_web/controllers/admin/achievement_controller.ex index 3dbc32e34..c60694822 100644 --- a/lib/teiserver_web/controllers/admin/achievement_controller.ex +++ b/lib/teiserver_web/controllers/admin/achievement_controller.ex @@ -15,10 +15,10 @@ defmodule TeiserverWeb.Admin.AchievementController do sub_menu_active: "achievements" ) - plug :add_breadcrumb, name: 'Game', url: '/teiserver' - plug :add_breadcrumb, name: 'AchievementTypes', url: '/teiserver/achievement_types' + plug :add_breadcrumb, name: "Game", url: "/teiserver" + plug :add_breadcrumb, name: "AchievementTypes", url: "/teiserver/achievement_types" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do achievement_types = Game.list_achievement_types( @@ -33,7 +33,7 @@ defmodule TeiserverWeb.Admin.AchievementController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do achievement_type = Game.get_achievement_type!(id, @@ -50,7 +50,7 @@ defmodule TeiserverWeb.Admin.AchievementController do |> render("show.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Game.change_achievement_type(%AchievementType{ @@ -64,7 +64,7 @@ defmodule TeiserverWeb.Admin.AchievementController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"achievement_type" => achievement_type_params}) do case Game.create_achievement_type(achievement_type_params) do {:ok, _achievement_type} -> @@ -79,7 +79,7 @@ defmodule TeiserverWeb.Admin.AchievementController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do achievement_type = Game.get_achievement_type!(id) @@ -92,7 +92,7 @@ defmodule TeiserverWeb.Admin.AchievementController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "achievement_type" => achievement_type_params}) do achievement_type = Game.get_achievement_type!(id) @@ -110,7 +110,7 @@ defmodule TeiserverWeb.Admin.AchievementController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do achievement_type = Game.get_achievement_type!(id) diff --git a/lib/teiserver_web/controllers/admin/autohost_controller.ex b/lib/teiserver_web/controllers/admin/autohost_controller.ex index 2ccc0354f..b2ce1da76 100644 --- a/lib/teiserver_web/controllers/admin/autohost_controller.ex +++ b/lib/teiserver_web/controllers/admin/autohost_controller.ex @@ -16,8 +16,8 @@ defmodule TeiserverWeb.Admin.AutohostController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Autohosts', url: '/teiserver/admin/autohost' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Autohosts", url: "/teiserver/admin/autohost" @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do diff --git a/lib/teiserver_web/controllers/admin/badge_type_controller.ex b/lib/teiserver_web/controllers/admin/badge_type_controller.ex index d551a30a8..e038b06db 100644 --- a/lib/teiserver_web/controllers/admin/badge_type_controller.ex +++ b/lib/teiserver_web/controllers/admin/badge_type_controller.ex @@ -15,10 +15,10 @@ defmodule TeiserverWeb.Admin.BadgeTypeController do site_menu_active: "admin" ) - plug :add_breadcrumb, name: 'Account', url: '/teiserver' - plug :add_breadcrumb, name: 'BadgeTypes', url: '/teiserver/badge_types' + plug :add_breadcrumb, name: "Account", url: "/teiserver" + plug :add_breadcrumb, name: "BadgeTypes", url: "/teiserver/badge_types" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do badge_types = Account.list_badge_types( @@ -33,7 +33,7 @@ defmodule TeiserverWeb.Admin.BadgeTypeController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do badge_type = Account.get_badge_type!(id, @@ -50,7 +50,7 @@ defmodule TeiserverWeb.Admin.BadgeTypeController do |> render("show.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Account.change_badge_type(%BadgeType{ @@ -64,7 +64,7 @@ defmodule TeiserverWeb.Admin.BadgeTypeController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"badge_type" => badge_type_params}) do case Account.create_badge_type(badge_type_params) do {:ok, _badge_type} -> @@ -79,7 +79,7 @@ defmodule TeiserverWeb.Admin.BadgeTypeController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do badge_type = Account.get_badge_type!(id) @@ -92,7 +92,7 @@ defmodule TeiserverWeb.Admin.BadgeTypeController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "badge_type" => badge_type_params}) do badge_type = Account.get_badge_type!(id) @@ -110,7 +110,7 @@ defmodule TeiserverWeb.Admin.BadgeTypeController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do badge_type = Account.get_badge_type!(id) diff --git a/lib/teiserver_web/controllers/admin/chat_controller.ex b/lib/teiserver_web/controllers/admin/chat_controller.ex index c73a2c371..feeb7af37 100644 --- a/lib/teiserver_web/controllers/admin/chat_controller.ex +++ b/lib/teiserver_web/controllers/admin/chat_controller.ex @@ -14,10 +14,10 @@ defmodule TeiserverWeb.Admin.ChatController do sub_menu_active: "chat" ) - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Chat', url: '/admin/chat' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Chat", url: "/admin/chat" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, %{"search" => params}) do inserted_after = case params["timeframe"] do diff --git a/lib/teiserver_web/controllers/admin/code_controller.ex b/lib/teiserver_web/controllers/admin/code_controller.ex index db31179bb..d211c5576 100644 --- a/lib/teiserver_web/controllers/admin/code_controller.ex +++ b/lib/teiserver_web/controllers/admin/code_controller.ex @@ -14,10 +14,10 @@ defmodule TeiserverWeb.Admin.CodeController do sub_menu_active: "code" ) - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Codes', url: '/teiserver/admin/codes' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Codes", url: "/teiserver/admin/codes" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do codes = Account.list_codes( @@ -33,7 +33,7 @@ defmodule TeiserverWeb.Admin.CodeController do |> render("index.html") end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do code = Account.get_code!(nil, @@ -47,7 +47,7 @@ defmodule TeiserverWeb.Admin.CodeController do |> redirect(to: Routes.admin_code_path(conn, :index)) end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Account.change_code(%Code{expires: "24 hours"}) @@ -58,7 +58,7 @@ defmodule TeiserverWeb.Admin.CodeController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"code" => code_params}) do code_params = Map.merge(code_params, %{ @@ -79,7 +79,7 @@ defmodule TeiserverWeb.Admin.CodeController do end end - @spec extend(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec extend(Plug.Conn.t(), map()) :: Plug.Conn.t() def extend(conn, %{"id" => id, "hours" => hours}) do code = Account.get_code!(nil, search: [id: id]) diff --git a/lib/teiserver_web/controllers/admin/discord_channel_controller.ex b/lib/teiserver_web/controllers/admin/discord_channel_controller.ex index d28e5ea3c..6500aba57 100644 --- a/lib/teiserver_web/controllers/admin/discord_channel_controller.ex +++ b/lib/teiserver_web/controllers/admin/discord_channel_controller.ex @@ -16,10 +16,10 @@ defmodule TeiserverWeb.Admin.DiscordChannelController do sub_menu_active: "discord_channel" ) - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Discord channels', url: '/admin/discord_channels' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Discord channels", url: "/admin/discord_channels" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do discord_channels = Communication.list_discord_channels( @@ -34,7 +34,7 @@ defmodule TeiserverWeb.Admin.DiscordChannelController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do discord_channel = Communication.get_discord_channel!(id) @@ -44,7 +44,7 @@ defmodule TeiserverWeb.Admin.DiscordChannelController do |> render("show.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Communication.change_discord_channel(%Communication.DiscordChannel{ @@ -59,7 +59,7 @@ defmodule TeiserverWeb.Admin.DiscordChannelController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"discord_channel" => params}) do name = if String.starts_with?(params["special_name"], "--") do @@ -84,7 +84,7 @@ defmodule TeiserverWeb.Admin.DiscordChannelController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do discord_channel = Communication.get_discord_channel!(id) @@ -98,7 +98,7 @@ defmodule TeiserverWeb.Admin.DiscordChannelController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "discord_channel" => discord_channel_params}) do discord_channel_params = Map.merge(discord_channel_params, %{ @@ -126,7 +126,7 @@ defmodule TeiserverWeb.Admin.DiscordChannelController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do discord_channel = Communication.get_discord_channel!(id) diff --git a/lib/teiserver_web/controllers/admin/general_controller.ex b/lib/teiserver_web/controllers/admin/general_controller.ex index 6aab3652d..3aeab0bfc 100644 --- a/lib/teiserver_web/controllers/admin/general_controller.ex +++ b/lib/teiserver_web/controllers/admin/general_controller.ex @@ -12,7 +12,7 @@ defmodule TeiserverWeb.Admin.GeneralController do user: {Teiserver.Account.AuthLib, :current_user} ) - plug(:add_breadcrumb, name: 'Admin', url: '/teiserver/admin') + plug(:add_breadcrumb, name: "Admin", url: "/teiserver/admin") @spec index(Plug.Conn.t(), map) :: Plug.Conn.t() def index(conn, _params) do diff --git a/lib/teiserver_web/controllers/admin/lobby_controller.ex b/lib/teiserver_web/controllers/admin/lobby_controller.ex index 0488af6d6..62f197894 100644 --- a/lib/teiserver_web/controllers/admin/lobby_controller.ex +++ b/lib/teiserver_web/controllers/admin/lobby_controller.ex @@ -16,8 +16,8 @@ defmodule TeiserverWeb.Admin.LobbyController do user: {Teiserver.Account.AuthLib, :current_user} ) - plug(:add_breadcrumb, name: 'Admin', url: '/teiserver/admin') - plug(:add_breadcrumb, name: 'Users', url: '/teiserver/admin/user') + plug(:add_breadcrumb, name: "Admin", url: "/teiserver/admin") + plug(:add_breadcrumb, name: "Users", url: "/teiserver/admin/user") @page_size 500 diff --git a/lib/teiserver_web/controllers/admin/lobby_policy_controller.ex b/lib/teiserver_web/controllers/admin/lobby_policy_controller.ex index ff7997b7d..90926a547 100644 --- a/lib/teiserver_web/controllers/admin/lobby_policy_controller.ex +++ b/lib/teiserver_web/controllers/admin/lobby_policy_controller.ex @@ -16,10 +16,10 @@ defmodule TeiserverWeb.Admin.LobbyPolicyController do sub_menu_active: "lobby_policy" ) - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Lobby policies', url: '/admin/lobby_policies' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Lobby policies", url: "/admin/lobby_policies" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do lobby_policies = Game.list_lobby_policies( @@ -34,7 +34,7 @@ defmodule TeiserverWeb.Admin.LobbyPolicyController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do lobby_policy = Game.get_lobby_policy!(id, @@ -51,7 +51,7 @@ defmodule TeiserverWeb.Admin.LobbyPolicyController do |> render("show.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Game.change_lobby_policy(%Game.LobbyPolicy{ @@ -65,7 +65,7 @@ defmodule TeiserverWeb.Admin.LobbyPolicyController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"lobby_policy" => lobby_policy_params}) do lobby_policy_params = Map.merge(lobby_policy_params, %{ @@ -94,7 +94,7 @@ defmodule TeiserverWeb.Admin.LobbyPolicyController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do lobby_policy = Game.get_lobby_policy!(id) @@ -107,7 +107,7 @@ defmodule TeiserverWeb.Admin.LobbyPolicyController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "lobby_policy" => lobby_policy_params}) do lobby_policy_params = Map.merge(lobby_policy_params, %{ @@ -139,7 +139,7 @@ defmodule TeiserverWeb.Admin.LobbyPolicyController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do lobby_policy = Game.get_lobby_policy!(id) diff --git a/lib/teiserver_web/controllers/admin/match_controller.ex b/lib/teiserver_web/controllers/admin/match_controller.ex index b20c794b2..9c3f6a894 100644 --- a/lib/teiserver_web/controllers/admin/match_controller.ex +++ b/lib/teiserver_web/controllers/admin/match_controller.ex @@ -15,10 +15,10 @@ defmodule TeiserverWeb.Admin.MatchController do sub_menu_active: "match" ) - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Matches', url: '/teiserver/admin/matches' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Matches", url: "/teiserver/admin/matches" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do matches = Battle.list_matches( @@ -65,7 +65,7 @@ defmodule TeiserverWeb.Admin.MatchController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do conn |> put_flash( @@ -75,7 +75,7 @@ defmodule TeiserverWeb.Admin.MatchController do |> redirect(to: ~p"/battle/#{id}") end - @spec user_show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec user_show(Plug.Conn.t(), map()) :: Plug.Conn.t() def user_show(conn, params = %{"user_id" => userid}) do matches = Battle.list_matches( @@ -99,7 +99,7 @@ defmodule TeiserverWeb.Admin.MatchController do |> render("user_index.html") end - @spec server_index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec server_index(Plug.Conn.t(), map()) :: Plug.Conn.t() def server_index(conn, %{"uuid" => uuid}) do matches = Battle.list_matches( diff --git a/lib/teiserver_web/controllers/admin/o_auth_application_controller.ex b/lib/teiserver_web/controllers/admin/o_auth_application_controller.ex index 86c928a68..cd2bf1723 100644 --- a/lib/teiserver_web/controllers/admin/o_auth_application_controller.ex +++ b/lib/teiserver_web/controllers/admin/o_auth_application_controller.ex @@ -12,8 +12,8 @@ defmodule TeiserverWeb.Admin.OAuthApplicationController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'OAuth Applications', url: '/teiserver/admin/oauth_application' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "OAuth Applications", url: "/teiserver/admin/oauth_application" @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do diff --git a/lib/teiserver_web/controllers/admin/site_config_controller.ex b/lib/teiserver_web/controllers/admin/site_config_controller.ex index 7412a43ef..e3d1b0f6d 100644 --- a/lib/teiserver_web/controllers/admin/site_config_controller.ex +++ b/lib/teiserver_web/controllers/admin/site_config_controller.ex @@ -9,8 +9,8 @@ defmodule TeiserverWeb.Admin.SiteConfigController do user: {Teiserver.Account.AuthLib, :current_user} # plug :add_breadcrumb, name: 'Alacrity', url: '/' - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Site config', url: '/config/site' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Site config", url: "/config/site" plug(AssignPlug, site_menu_active: "admin", diff --git a/lib/teiserver_web/controllers/admin/text_callback_controller.ex b/lib/teiserver_web/controllers/admin/text_callback_controller.ex index 439d3fa4f..948610b90 100644 --- a/lib/teiserver_web/controllers/admin/text_callback_controller.ex +++ b/lib/teiserver_web/controllers/admin/text_callback_controller.ex @@ -16,10 +16,10 @@ defmodule TeiserverWeb.Admin.TextCallbackController do sub_menu_active: "text_callback" ) - plug :add_breadcrumb, name: 'Admin', url: '/teiserver/admin' - plug :add_breadcrumb, name: 'Lobby policies', url: '/admin/text_callbacks' + plug :add_breadcrumb, name: "Admin", url: "/teiserver/admin" + plug :add_breadcrumb, name: "Lobby policies", url: "/admin/text_callbacks" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do text_callbacks = Communication.list_text_callbacks( @@ -34,7 +34,7 @@ defmodule TeiserverWeb.Admin.TextCallbackController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do text_callback = Communication.get_text_callback!(id, @@ -75,7 +75,7 @@ defmodule TeiserverWeb.Admin.TextCallbackController do |> render("show.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Communication.change_text_callback(%Communication.TextCallback{ @@ -89,7 +89,7 @@ defmodule TeiserverWeb.Admin.TextCallbackController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"text_callback" => text_callback_params}) do text_callback_params = Map.merge(text_callback_params, %{ @@ -113,7 +113,7 @@ defmodule TeiserverWeb.Admin.TextCallbackController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do text_callback = Communication.get_text_callback!(id) @@ -126,7 +126,7 @@ defmodule TeiserverWeb.Admin.TextCallbackController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "text_callback" => text_callback_params}) do text_callback_params = Map.merge(text_callback_params, %{ @@ -153,7 +153,7 @@ defmodule TeiserverWeb.Admin.TextCallbackController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do text_callback = Communication.get_text_callback!(id) diff --git a/lib/teiserver_web/controllers/admin/tool_controller.ex b/lib/teiserver_web/controllers/admin/tool_controller.ex index 68f49b2ca..c438b0505 100644 --- a/lib/teiserver_web/controllers/admin/tool_controller.ex +++ b/lib/teiserver_web/controllers/admin/tool_controller.ex @@ -14,13 +14,13 @@ defmodule TeiserverWeb.Admin.ToolController do plug(:add_breadcrumb, name: "Admin", url: "/teiserver/admin") plug(:add_breadcrumb, name: "Tools", url: "/teiserver/admin/tools") - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do conn |> render("index.html") end - @spec test_page(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec test_page(Plug.Conn.t(), map()) :: Plug.Conn.t() def test_page(conn, params) do layout = case params["layout"] do @@ -53,7 +53,7 @@ defmodule TeiserverWeb.Admin.ToolController do end # List of font awesome icons - @spec falist(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec falist(Plug.Conn.t(), map()) :: Plug.Conn.t() def falist(conn, _params) do conn |> render("falist.html") diff --git a/lib/teiserver_web/controllers/admin/user_controller.ex b/lib/teiserver_web/controllers/admin/user_controller.ex index ab4a9b754..6d10a9fd3 100644 --- a/lib/teiserver_web/controllers/admin/user_controller.ex +++ b/lib/teiserver_web/controllers/admin/user_controller.ex @@ -21,8 +21,8 @@ defmodule TeiserverWeb.Admin.UserController do user: {Teiserver.Account.AuthLib, :current_user} ) - plug(:add_breadcrumb, name: 'Admin', url: '/teiserver/admin') - plug(:add_breadcrumb, name: 'Users', url: '/teiserver/admin/user') + plug(:add_breadcrumb, name: "Admin", url: "/teiserver/admin") + plug(:add_breadcrumb, name: "Users", url: "/teiserver/admin/user") @spec index(Plug.Conn.t(), map) :: Plug.Conn.t() def index(conn, params) do @@ -58,7 +58,7 @@ defmodule TeiserverWeb.Admin.UserController do end end - @spec search(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec search(Plug.Conn.t(), map()) :: Plug.Conn.t() def search(conn, %{"search" => params}) do params = Map.merge(search_defaults(conn), params) @@ -1083,7 +1083,7 @@ defmodule TeiserverWeb.Admin.UserController do |> redirect(to: ~p"/teiserver/admin/user/#{id}" <> tab) end - @spec search_defaults(Plug.Conn.t()) :: Map.t() + @spec search_defaults(Plug.Conn.t()) :: map() defp search_defaults(_conn) do %{ "limit" => 50 diff --git a/lib/teiserver_web/controllers/api/hailstorm_controller.ex b/lib/teiserver_web/controllers/api/hailstorm_controller.ex index 2be344c2d..bdc2c48e2 100644 --- a/lib/teiserver_web/controllers/api/hailstorm_controller.ex +++ b/lib/teiserver_web/controllers/api/hailstorm_controller.ex @@ -200,7 +200,7 @@ defmodule TeiserverWeb.API.HailstormController do end defmodule Teiserver.API.HailstormAuth do - @spec authorize(Atom.t(), Plug.Conn.t(), Map.t()) :: Boolean.t() + @spec authorize(Atom.t(), Plug.Conn.t(), map()) :: Boolean.t() def authorize(_, _, _) do Application.get_env(:teiserver, Teiserver)[:enable_hailstorm] end diff --git a/lib/teiserver_web/controllers/api/session_controller.ex b/lib/teiserver_web/controllers/api/session_controller.ex index c53368758..77b7e06d4 100644 --- a/lib/teiserver_web/controllers/api/session_controller.ex +++ b/lib/teiserver_web/controllers/api/session_controller.ex @@ -3,7 +3,7 @@ defmodule TeiserverWeb.API.SessionController do alias Teiserver.{Account, CacheUser} alias Teiserver.Account.UserLib - @spec login(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec login(Plug.Conn.t(), map()) :: Plug.Conn.t() def login(conn, %{"user" => %{"email" => email, "password" => password}}) do conn |> UserLib.authenticate_user(email, password) @@ -117,7 +117,7 @@ defmodule TeiserverWeb.API.SessionController do |> render("register.json", %{result: :failure, reason: reason}) end - @spec request_token(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec request_token(Plug.Conn.t(), map()) :: Plug.Conn.t() def request_token(conn, %{"email" => email, "password" => raw_password} = params) do expires = case Map.get(params, "ttl", nil) do diff --git a/lib/teiserver_web/controllers/battle/general_controller.ex b/lib/teiserver_web/controllers/battle/general_controller.ex index 22671af2e..2a574b874 100644 --- a/lib/teiserver_web/controllers/battle/general_controller.ex +++ b/lib/teiserver_web/controllers/battle/general_controller.ex @@ -1,7 +1,7 @@ defmodule TeiserverWeb.Battle.GeneralController do use TeiserverWeb, :controller - plug(:add_breadcrumb, name: 'Battle', url: '/battle') + plug(:add_breadcrumb, name: "Battle", url: "/battle") plug(AssignPlug, site_menu_active: "teiserver_match", @@ -10,7 +10,7 @@ defmodule TeiserverWeb.Battle.GeneralController do plug(Teiserver.ServerUserPlug) - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do render(conn, "index.html") end diff --git a/lib/teiserver_web/controllers/battle/match_controller.ex b/lib/teiserver_web/controllers/battle/match_controller.ex index aac17f22b..70724b0a7 100644 --- a/lib/teiserver_web/controllers/battle/match_controller.ex +++ b/lib/teiserver_web/controllers/battle/match_controller.ex @@ -16,9 +16,9 @@ defmodule TeiserverWeb.Battle.MatchController do sub_menu_active: "match" ) - plug :add_breadcrumb, name: 'Matches', url: '/battle' + plug :add_breadcrumb, name: "Matches", url: "/battle" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do matches = Battle.list_matches( @@ -37,7 +37,7 @@ defmodule TeiserverWeb.Battle.MatchController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do match = Battle.get_match!(id, diff --git a/lib/teiserver_web/controllers/battle/ratings_controller.ex b/lib/teiserver_web/controllers/battle/ratings_controller.ex index 7f82ef65b..8015259f2 100644 --- a/lib/teiserver_web/controllers/battle/ratings_controller.ex +++ b/lib/teiserver_web/controllers/battle/ratings_controller.ex @@ -14,9 +14,9 @@ defmodule TeiserverWeb.Battle.RatingsController do sub_menu_active: "match" ) - plug :add_breadcrumb, name: 'Matches', url: '/teiserver/matches' + plug :add_breadcrumb, name: "Matches", url: "/teiserver/matches" - @spec leaderboard(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec leaderboard(Plug.Conn.t(), map()) :: Plug.Conn.t() def leaderboard(conn, params) do activity_time = Timex.today() diff --git a/lib/teiserver_web/controllers/game/queue_controller.ex b/lib/teiserver_web/controllers/game/queue_controller.ex index 6105c8284..a9b83576b 100644 --- a/lib/teiserver_web/controllers/game/queue_controller.ex +++ b/lib/teiserver_web/controllers/game/queue_controller.ex @@ -17,10 +17,10 @@ defmodule TeiserverWeb.Game.QueueController do sub_menu_active: "queue" ) - plug :add_breadcrumb, name: 'Game', url: '/teiserver' - plug :add_breadcrumb, name: 'Queues', url: '/teiserver/queues' + plug :add_breadcrumb, name: "Game", url: "/teiserver" + plug :add_breadcrumb, name: "Queues", url: "/teiserver/queues" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do queues = Game.list_queues( @@ -35,7 +35,7 @@ defmodule TeiserverWeb.Game.QueueController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do queue = Game.get_queue!(id, @@ -52,7 +52,7 @@ defmodule TeiserverWeb.Game.QueueController do |> render("show.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Game.change_queue(%Queue{ @@ -66,7 +66,7 @@ defmodule TeiserverWeb.Game.QueueController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"queue" => queue_params}) do queue_params = Map.merge(queue_params, %{ @@ -90,7 +90,7 @@ defmodule TeiserverWeb.Game.QueueController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do queue = Game.get_queue!(id) @@ -103,7 +103,7 @@ defmodule TeiserverWeb.Game.QueueController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "queue" => queue_params}) do queue = Game.get_queue!(id) @@ -130,7 +130,7 @@ defmodule TeiserverWeb.Game.QueueController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do queue = Game.get_queue!(id) diff --git a/lib/teiserver_web/controllers/general/general_controller.ex b/lib/teiserver_web/controllers/general/general_controller.ex index 39c1bc551..3a9af48be 100644 --- a/lib/teiserver_web/controllers/general/general_controller.ex +++ b/lib/teiserver_web/controllers/general/general_controller.ex @@ -8,13 +8,13 @@ defmodule TeiserverWeb.General.GeneralController do plug(Teiserver.ServerUserPlug) - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do conn |> redirect(to: ~p"/") end - @spec gdpr(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec gdpr(Plug.Conn.t(), map()) :: Plug.Conn.t() def gdpr(conn, _params) do host = Application.get_env(:teiserver, TeiserverWeb.Endpoint)[:url][:host] website_url = "https://#{host}" @@ -29,7 +29,7 @@ defmodule TeiserverWeb.General.GeneralController do |> render("gdpr.html") end - @spec code_of_conduct(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec code_of_conduct(Plug.Conn.t(), map()) :: Plug.Conn.t() def code_of_conduct(conn, _params) do conn |> render("code_of_conduct.html") diff --git a/lib/teiserver_web/controllers/logging/aggregate_view_log_controller.ex b/lib/teiserver_web/controllers/logging/aggregate_view_log_controller.ex index c26451bc8..b9b6f5849 100644 --- a/lib/teiserver_web/controllers/logging/aggregate_view_log_controller.ex +++ b/lib/teiserver_web/controllers/logging/aggregate_view_log_controller.ex @@ -13,15 +13,15 @@ defmodule TeiserverWeb.Logging.AggregateViewLogController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug :add_breadcrumb, name: 'Logging', url: '/logging' - plug :add_breadcrumb, name: 'Aggregate', url: '/logging/aggregate_views' + plug :add_breadcrumb, name: "Logging", url: "/logging" + plug :add_breadcrumb, name: "Aggregate", url: "/logging/aggregate_views" plug(AssignPlug, site_menu_active: "logging", sub_menu_active: "aggregate" ) - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do logs = Logging.list_aggregate_view_logs( @@ -36,7 +36,7 @@ defmodule TeiserverWeb.Logging.AggregateViewLogController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"date" => date}) do date = TimexHelper.parse_ymd(date) @@ -47,7 +47,7 @@ defmodule TeiserverWeb.Logging.AggregateViewLogController do |> render("show.html") end - @spec perform_form(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec perform_form(Plug.Conn.t(), map()) :: Plug.Conn.t() def perform_form(conn, _params) do last_date = AggregateViewLogLib.get_last_aggregate_date() @@ -73,7 +73,7 @@ defmodule TeiserverWeb.Logging.AggregateViewLogController do end end - @spec perform_post(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec perform_post(Plug.Conn.t(), map()) :: Plug.Conn.t() def perform_post(conn, _params) do AggregateViewLogsTask.perform(%{}) diff --git a/lib/teiserver_web/controllers/logging/audit_log_controller.ex b/lib/teiserver_web/controllers/logging/audit_log_controller.ex index 96595ace7..92144ccf3 100644 --- a/lib/teiserver_web/controllers/logging/audit_log_controller.ex +++ b/lib/teiserver_web/controllers/logging/audit_log_controller.ex @@ -7,8 +7,8 @@ defmodule TeiserverWeb.Logging.AuditLogController do import Teiserver.Helper.StringHelper, only: [get_hash_id: 1] - plug :add_breadcrumb, name: 'Logging', url: '/logging' - plug :add_breadcrumb, name: 'Audit', url: '/logging/audit' + plug :add_breadcrumb, name: "Logging", url: "/logging" + plug :add_breadcrumb, name: "Audit", url: "/logging/audit" plug Bodyguard.Plug.Authorize, policy: Teiserver.Logging.AuditLog, @@ -20,7 +20,7 @@ defmodule TeiserverWeb.Logging.AuditLogController do sub_menu_active: "audit" ) - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do logs = Logging.list_audit_logs( @@ -36,7 +36,7 @@ defmodule TeiserverWeb.Logging.AuditLogController do |> render("index.html") end - @spec search(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec search(Plug.Conn.t(), map()) :: Plug.Conn.t() def search(conn, %{"search" => params}) do params = form_params(params) @@ -59,7 +59,7 @@ defmodule TeiserverWeb.Logging.AuditLogController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do log = Logging.get_audit_log!(id, joins: [:user, :group]) @@ -68,7 +68,7 @@ defmodule TeiserverWeb.Logging.AuditLogController do |> render("show.html") end - @spec form_params(Map.t()) :: Map.t() + @spec form_params(map()) :: map() defp form_params(params \\ %{}) do %{ "action" => Map.get(params, "action", ""), diff --git a/lib/teiserver_web/controllers/logging/general_controller.ex b/lib/teiserver_web/controllers/logging/general_controller.ex index ceb016e71..596f1d882 100644 --- a/lib/teiserver_web/controllers/logging/general_controller.ex +++ b/lib/teiserver_web/controllers/logging/general_controller.ex @@ -1,7 +1,7 @@ defmodule TeiserverWeb.Logging.GeneralController do use TeiserverWeb, :controller - plug :add_breadcrumb, name: 'Logging', url: '/logging' + plug :add_breadcrumb, name: "Logging", url: "/logging" plug(AssignPlug, site_menu_active: "logging", @@ -13,7 +13,7 @@ defmodule TeiserverWeb.Logging.GeneralController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do render(conn, "index.html") end diff --git a/lib/teiserver_web/controllers/logging/match_log_controller.ex b/lib/teiserver_web/controllers/logging/match_log_controller.ex index 2c140e1e1..5090013e0 100644 --- a/lib/teiserver_web/controllers/logging/match_log_controller.ex +++ b/lib/teiserver_web/controllers/logging/match_log_controller.ex @@ -16,8 +16,8 @@ defmodule TeiserverWeb.Logging.MatchLogController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Reports', url: '/teiserver/reports') - plug(:add_breadcrumb, name: 'Match metrics', url: '/teiserver/reports/match/day_metrics') + plug(:add_breadcrumb, name: "Reports", url: "/teiserver/reports") + plug(:add_breadcrumb, name: "Match metrics", url: "/teiserver/reports/match/day_metrics") # DAILY METRICS @spec day_metrics_list(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/controllers/logging/page_view_log_controller.ex b/lib/teiserver_web/controllers/logging/page_view_log_controller.ex index 20a80471e..893423e17 100644 --- a/lib/teiserver_web/controllers/logging/page_view_log_controller.ex +++ b/lib/teiserver_web/controllers/logging/page_view_log_controller.ex @@ -5,8 +5,8 @@ defmodule TeiserverWeb.Logging.PageViewLogController do alias Teiserver.Helper.TimexHelper import Teiserver.Helper.StringHelper, only: [get_hash_id: 1] - plug :add_breadcrumb, name: 'Logging', url: '/logging' - plug :add_breadcrumb, name: 'Page views', url: '/logging/page_views' + plug :add_breadcrumb, name: "Logging", url: "/logging" + plug :add_breadcrumb, name: "Page views", url: "/logging/page_views" plug(AssignPlug, site_menu_active: "logging", @@ -18,7 +18,7 @@ defmodule TeiserverWeb.Logging.PageViewLogController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do page_view_logs = Logging.list_page_view_logs( @@ -39,7 +39,7 @@ defmodule TeiserverWeb.Logging.PageViewLogController do |> render("index.html") end - @spec search(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec search(Plug.Conn.t(), map()) :: Plug.Conn.t() def search(conn, %{"search" => params}) do params = form_params(params) @@ -65,14 +65,14 @@ defmodule TeiserverWeb.Logging.PageViewLogController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do page_view_log = Logging.get_page_view_log!(id, joins: [:user]) render(conn, "show.html", page_view_log: page_view_log) end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do page_view_log = Logging.get_page_view_log!(id) @@ -85,7 +85,7 @@ defmodule TeiserverWeb.Logging.PageViewLogController do |> redirect(to: Routes.logging_page_view_log_path(conn, :index)) end - @spec form_params(Map.t()) :: Map.t() + @spec form_params(map()) :: map() defp form_params(params \\ %{}) do %{ "section" => Map.get(params, "section", "any"), diff --git a/lib/teiserver_web/controllers/moderation/action_controller.ex b/lib/teiserver_web/controllers/moderation/action_controller.ex index 4e72370ad..064d70984 100644 --- a/lib/teiserver_web/controllers/moderation/action_controller.ex +++ b/lib/teiserver_web/controllers/moderation/action_controller.ex @@ -18,10 +18,10 @@ defmodule TeiserverWeb.Moderation.ActionController do sub_menu_active: "action" ) - plug :add_breadcrumb, name: 'Moderation', url: '/teiserver' - plug :add_breadcrumb, name: 'Actions', url: '/teiserver/actions' + plug :add_breadcrumb, name: "Moderation", url: "/teiserver" + plug :add_breadcrumb, name: "Actions", url: "/teiserver/actions" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do actions = Moderation.list_actions( @@ -39,7 +39,7 @@ defmodule TeiserverWeb.Moderation.ActionController do |> render("index.html") end - @spec search(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec search(Plug.Conn.t(), map()) :: Plug.Conn.t() def search(conn, %{"search" => params}) do actions = Moderation.list_actions( @@ -58,7 +58,7 @@ defmodule TeiserverWeb.Moderation.ActionController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do action = Moderation.get_action!(id, @@ -99,7 +99,7 @@ defmodule TeiserverWeb.Moderation.ActionController do |> render("show.html") end - @spec new_with_user(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new_with_user(Plug.Conn.t(), map()) :: Plug.Conn.t() def new_with_user(conn, params) do user = case params do @@ -172,7 +172,7 @@ defmodule TeiserverWeb.Moderation.ActionController do end end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Moderation.change_action(%Action{}) @@ -182,7 +182,7 @@ defmodule TeiserverWeb.Moderation.ActionController do |> render("new_select.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"action" => action_params}) do user = Account.get_user(action_params["target_id"]) @@ -257,7 +257,7 @@ defmodule TeiserverWeb.Moderation.ActionController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do action = Moderation.get_action!(id, preload: [:target]) @@ -271,7 +271,7 @@ defmodule TeiserverWeb.Moderation.ActionController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "action" => action_params}) do action = Moderation.get_action!(id) @@ -307,7 +307,7 @@ defmodule TeiserverWeb.Moderation.ActionController do end end - @spec re_post(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec re_post(Plug.Conn.t(), map()) :: Plug.Conn.t() def re_post(conn, %{"id" => id}) do action = Moderation.get_action!(id, preload: [:target]) @@ -337,7 +337,7 @@ defmodule TeiserverWeb.Moderation.ActionController do end end - @spec halt(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec halt(Plug.Conn.t(), map()) :: Plug.Conn.t() def halt(conn, %{"id" => id}) do action = Moderation.get_action!(id) @@ -353,7 +353,7 @@ defmodule TeiserverWeb.Moderation.ActionController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do action = Moderation.get_action!(id) diff --git a/lib/teiserver_web/controllers/moderation/ban_controller.ex b/lib/teiserver_web/controllers/moderation/ban_controller.ex index 231036f89..32a513e03 100644 --- a/lib/teiserver_web/controllers/moderation/ban_controller.ex +++ b/lib/teiserver_web/controllers/moderation/ban_controller.ex @@ -17,10 +17,10 @@ defmodule TeiserverWeb.Moderation.BanController do sub_menu_active: "ban" ) - plug :add_breadcrumb, name: 'Moderation', url: '/teiserver' - plug :add_breadcrumb, name: 'Bans', url: '/teiserver/bans' + plug :add_breadcrumb, name: "Moderation", url: "/teiserver" + plug :add_breadcrumb, name: "Bans", url: "/teiserver/bans" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do bans = Moderation.list_bans( @@ -34,7 +34,7 @@ defmodule TeiserverWeb.Moderation.BanController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do ban = Moderation.get_ban!(id, @@ -75,7 +75,7 @@ defmodule TeiserverWeb.Moderation.BanController do |> render("show.html") end - @spec new_with_user(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new_with_user(Plug.Conn.t(), map()) :: Plug.Conn.t() def new_with_user(conn, %{"teiserver_user" => user_str}) do user = cond do @@ -159,14 +159,14 @@ defmodule TeiserverWeb.Moderation.BanController do end end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do conn |> add_breadcrumb(name: "New ban", url: conn.request_path) |> render("new_select.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"ban" => ban_params}) do key_values = ban_params["key_values"] @@ -252,7 +252,7 @@ defmodule TeiserverWeb.Moderation.BanController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do ban = Moderation.get_ban!(id, preload: [:source]) @@ -287,7 +287,7 @@ defmodule TeiserverWeb.Moderation.BanController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "ban" => ban_params}) do ban = Moderation.get_ban!(id) @@ -321,7 +321,7 @@ defmodule TeiserverWeb.Moderation.BanController do end end - @spec enable(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec enable(Plug.Conn.t(), map()) :: Plug.Conn.t() def enable(conn, %{"id" => id}) do ban = Moderation.get_ban!(id) @@ -335,7 +335,7 @@ defmodule TeiserverWeb.Moderation.BanController do end end - @spec disable(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec disable(Plug.Conn.t(), map()) :: Plug.Conn.t() def disable(conn, %{"id" => id}) do ban = Moderation.get_ban!(id) diff --git a/lib/teiserver_web/controllers/moderation/general_controller.ex b/lib/teiserver_web/controllers/moderation/general_controller.ex index e045ac998..47ce5c2a5 100644 --- a/lib/teiserver_web/controllers/moderation/general_controller.ex +++ b/lib/teiserver_web/controllers/moderation/general_controller.ex @@ -2,7 +2,7 @@ defmodule TeiserverWeb.Moderation.GeneralController do @moduledoc false use TeiserverWeb, :controller - plug :add_breadcrumb, name: 'Moderation', url: '/moderation' + plug :add_breadcrumb, name: "Moderation", url: "/moderation" plug(AssignPlug, site_menu_active: "moderation", @@ -14,7 +14,7 @@ defmodule TeiserverWeb.Moderation.GeneralController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, _params) do render(conn, "index.html") end diff --git a/lib/teiserver_web/controllers/moderation/proposal_controller.ex b/lib/teiserver_web/controllers/moderation/proposal_controller.ex index 816080fee..2cba25c83 100644 --- a/lib/teiserver_web/controllers/moderation/proposal_controller.ex +++ b/lib/teiserver_web/controllers/moderation/proposal_controller.ex @@ -16,10 +16,10 @@ defmodule TeiserverWeb.Moderation.ProposalController do sub_menu_active: "proposal" ) - plug :add_breadcrumb, name: 'Moderation', url: '/teiserver' - plug :add_breadcrumb, name: 'Proposals', url: '/teiserver/proposals' + plug :add_breadcrumb, name: "Moderation", url: "/teiserver" + plug :add_breadcrumb, name: "Proposals", url: "/teiserver/proposals" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do proposals = Moderation.list_proposals( @@ -36,7 +36,7 @@ defmodule TeiserverWeb.Moderation.ProposalController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do proposal = Moderation.get_proposal!(id, @@ -54,7 +54,7 @@ defmodule TeiserverWeb.Moderation.ProposalController do |> render("show.html") end - @spec new_with_user(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new_with_user(Plug.Conn.t(), map()) :: Plug.Conn.t() def new_with_user(conn, %{"teiserver_user" => user_str}) do user = cond do @@ -106,14 +106,14 @@ defmodule TeiserverWeb.Moderation.ProposalController do end end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do conn |> add_breadcrumb(name: "New ban", url: conn.request_path) |> render("new_select.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"proposal" => proposal_params}) do user = Account.get_user(proposal_params["target_id"]) @@ -177,7 +177,7 @@ defmodule TeiserverWeb.Moderation.ProposalController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do proposal = Moderation.get_proposal!(id, preload: [:target]) @@ -209,7 +209,7 @@ defmodule TeiserverWeb.Moderation.ProposalController do end end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "proposal" => proposal_params}) do proposal = Moderation.get_proposal!(id, preload: [:target, :votes]) @@ -261,7 +261,7 @@ defmodule TeiserverWeb.Moderation.ProposalController do end end - @spec vote(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec vote(Plug.Conn.t(), map()) :: Plug.Conn.t() def vote(conn, %{"proposal_id" => proposal_id, "direction" => direction}) do proposal = Moderation.get_proposal!(proposal_id) @@ -333,7 +333,7 @@ defmodule TeiserverWeb.Moderation.ProposalController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do proposal = Moderation.get_proposal!(id, preload: [:target]) @@ -348,7 +348,7 @@ defmodule TeiserverWeb.Moderation.ProposalController do |> redirect(to: Routes.moderation_proposal_path(conn, :index)) end - @spec conclude(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec conclude(Plug.Conn.t(), map()) :: Plug.Conn.t() def conclude(conn, %{"id" => id, "comments" => ""}) do conn |> put_flash(:danger, "Proposal cannot be concluded without comments") diff --git a/lib/teiserver_web/controllers/moderation/report_controller.ex b/lib/teiserver_web/controllers/moderation/report_controller.ex index df03e052c..720ae7c20 100644 --- a/lib/teiserver_web/controllers/moderation/report_controller.ex +++ b/lib/teiserver_web/controllers/moderation/report_controller.ex @@ -16,10 +16,10 @@ defmodule TeiserverWeb.Moderation.ReportController do sub_menu_active: "report" ) - plug :add_breadcrumb, name: 'Moderation', url: '/moderation' - plug :add_breadcrumb, name: 'Reports', url: '/moderation/reports' + plug :add_breadcrumb, name: "Moderation", url: "/moderation" + plug :add_breadcrumb, name: "Reports", url: "/moderation/reports" - @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec index(Plug.Conn.t(), map()) :: Plug.Conn.t() def index(conn, params) do reports = Moderation.list_reports( @@ -44,7 +44,7 @@ defmodule TeiserverWeb.Moderation.ReportController do |> render("index.html") end - @spec search(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec search(Plug.Conn.t(), map()) :: Plug.Conn.t() def search(conn, %{"search" => params}) do reports = Moderation.list_reports( @@ -80,7 +80,7 @@ defmodule TeiserverWeb.Moderation.ReportController do |> render("index.html") end - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, %{"id" => id}) do report = Moderation.get_report!(id, @@ -205,7 +205,7 @@ defmodule TeiserverWeb.Moderation.ReportController do |> render("user.html") end - @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec new(Plug.Conn.t(), map()) :: Plug.Conn.t() def new(conn, _params) do changeset = Moderation.change_report(%Report{}) @@ -215,7 +215,7 @@ defmodule TeiserverWeb.Moderation.ReportController do |> render("new.html") end - @spec create(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec create(Plug.Conn.t(), map()) :: Plug.Conn.t() def create(conn, %{"report" => report_params}) do case Moderation.create_report(report_params) do {:ok, _report} -> @@ -230,7 +230,7 @@ defmodule TeiserverWeb.Moderation.ReportController do end end - @spec respond(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec respond(Plug.Conn.t(), map()) :: Plug.Conn.t() def respond(conn, %{"id" => id, "response" => response_params}) do # Ensure the report exists Moderation.get_report!(id) @@ -270,7 +270,7 @@ defmodule TeiserverWeb.Moderation.ReportController do end end - @spec edit(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec edit(Plug.Conn.t(), map()) :: Plug.Conn.t() def edit(conn, %{"id" => id}) do report = Moderation.get_report!(id) @@ -283,7 +283,7 @@ defmodule TeiserverWeb.Moderation.ReportController do |> render("edit.html") end - @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec update(Plug.Conn.t(), map()) :: Plug.Conn.t() def update(conn, %{"id" => id, "report" => report_params}) do report = Moderation.get_report!(id) @@ -301,7 +301,7 @@ defmodule TeiserverWeb.Moderation.ReportController do end end - @spec close(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec close(Plug.Conn.t(), map()) :: Plug.Conn.t() def close(conn, %{"id" => id}) do report = Moderation.get_report!(id) @@ -318,7 +318,7 @@ defmodule TeiserverWeb.Moderation.ReportController do end end - @spec open(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec open(Plug.Conn.t(), map()) :: Plug.Conn.t() def open(conn, %{"id" => id}) do report = Moderation.get_report!(id) @@ -335,7 +335,7 @@ defmodule TeiserverWeb.Moderation.ReportController do end end - @spec delete(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t() def delete(conn, %{"id" => id}) do report = Moderation.get_report!(id, preload: [:target, :reporter]) diff --git a/lib/teiserver_web/controllers/moderation/user_controller.ex b/lib/teiserver_web/controllers/moderation/user_controller.ex index 83e51a5c0..045737cdc 100644 --- a/lib/teiserver_web/controllers/moderation/user_controller.ex +++ b/lib/teiserver_web/controllers/moderation/user_controller.ex @@ -15,8 +15,8 @@ defmodule TeiserverWeb.Moderation.UserController do user: {Teiserver.Account.AuthLib, :current_user} ) - plug(:add_breadcrumb, name: 'Moderation', url: '/moderation') - plug(:add_breadcrumb, name: 'Users', url: '/moderation/users') + plug(:add_breadcrumb, name: "Moderation", url: "/moderation") + plug(:add_breadcrumb, name: "Users", url: "/moderation/users") @spec show(Plug.Conn.t(), map) :: Plug.Conn.t() def show(conn, %{"id" => id}) do diff --git a/lib/teiserver_web/controllers/report/general_controller.ex b/lib/teiserver_web/controllers/report/general_controller.ex index c308c4ef6..09fbed06d 100644 --- a/lib/teiserver_web/controllers/report/general_controller.ex +++ b/lib/teiserver_web/controllers/report/general_controller.ex @@ -11,7 +11,7 @@ defmodule TeiserverWeb.Report.GeneralController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Reports', url: '/teiserver/reports') + plug(:add_breadcrumb, name: "Reports", url: "/teiserver/reports") @spec index(Plug.Conn.t(), map) :: Plug.Conn.t() def index(conn, _params) do diff --git a/lib/teiserver_web/controllers/report/rating_controller.ex b/lib/teiserver_web/controllers/report/rating_controller.ex index ea8b4bcd8..95297258e 100644 --- a/lib/teiserver_web/controllers/report/rating_controller.ex +++ b/lib/teiserver_web/controllers/report/rating_controller.ex @@ -13,8 +13,8 @@ defmodule TeiserverWeb.Report.RatingController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: ~c"Reports", url: ~c"/teiserver/reports") - plug(:add_breadcrumb, name: ~c"Reports", url: ~c"/teiserver/reports/ratings") + plug(:add_breadcrumb, name: "Reports", url: "/teiserver/reports") + plug(:add_breadcrumb, name: "Reports", url: "/teiserver/reports/ratings") @spec distribution_table(Plug.Conn.t(), map) :: Plug.Conn.t() def distribution_table(conn, _params) do diff --git a/lib/teiserver_web/controllers/report/report_controller.ex b/lib/teiserver_web/controllers/report/report_controller.ex index 086caddc4..325166729 100644 --- a/lib/teiserver_web/controllers/report/report_controller.ex +++ b/lib/teiserver_web/controllers/report/report_controller.ex @@ -12,9 +12,9 @@ defmodule TeiserverWeb.Report.ReportController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Reports', url: '/teiserver/reports') + plug(:add_breadcrumb, name: "Reports", url: "/teiserver/reports") - @spec show(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() + @spec show(Plug.Conn.t(), map()) :: Plug.Conn.t() def show(conn, params) do name = params["name"] diff --git a/lib/teiserver_web/controllers/telemetry/complex_client_event_controller.ex b/lib/teiserver_web/controllers/telemetry/complex_client_event_controller.ex index 75aa5994d..0a8555f40 100644 --- a/lib/teiserver_web/controllers/telemetry/complex_client_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/complex_client_event_controller.ex @@ -20,11 +20,11 @@ defmodule TeiserverWeb.Telemetry.ComplexClientEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") plug(:add_breadcrumb, - name: 'Complex client events', - url: '/telemetry/complex_client_events/summary' + name: "Complex client events", + url: "/telemetry/complex_client_events/summary" ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/controllers/telemetry/complex_lobby_event_controller.ex b/lib/teiserver_web/controllers/telemetry/complex_lobby_event_controller.ex index c7660eeaa..9d8a7b4a4 100644 --- a/lib/teiserver_web/controllers/telemetry/complex_lobby_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/complex_lobby_event_controller.ex @@ -14,11 +14,11 @@ defmodule TeiserverWeb.Telemetry.ComplexLobbyEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") plug(:add_breadcrumb, - name: 'Complex Lobby events', - url: '/telemetry/complex_lobby_events/summary' + name: "Complex Lobby events", + url: "/telemetry/complex_lobby_events/summary" ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/controllers/telemetry/complex_match_event_controller.ex b/lib/teiserver_web/controllers/telemetry/complex_match_event_controller.ex index 9cb99e95a..c009a789b 100644 --- a/lib/teiserver_web/controllers/telemetry/complex_match_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/complex_match_event_controller.ex @@ -14,11 +14,11 @@ defmodule TeiserverWeb.Telemetry.ComplexMatchEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") plug(:add_breadcrumb, - name: 'Complex Match events', - url: '/telemetry/complex_match_events/summary' + name: "Complex Match events", + url: "/telemetry/complex_match_events/summary" ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/controllers/telemetry/complex_server_event_controller.ex b/lib/teiserver_web/controllers/telemetry/complex_server_event_controller.ex index b35a5369a..91f5c3ffd 100644 --- a/lib/teiserver_web/controllers/telemetry/complex_server_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/complex_server_event_controller.ex @@ -14,11 +14,11 @@ defmodule TeiserverWeb.Telemetry.ComplexServerEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") plug(:add_breadcrumb, - name: 'Complex Server events', - url: '/telemetry/complex_server_events/summary' + name: "Complex Server events", + url: "/telemetry/complex_server_events/summary" ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/controllers/telemetry/general_controller.ex b/lib/teiserver_web/controllers/telemetry/general_controller.ex index ce00844eb..31db14155 100644 --- a/lib/teiserver_web/controllers/telemetry/general_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/general_controller.ex @@ -11,7 +11,7 @@ defmodule TeiserverWeb.Telemetry.GeneralController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") @spec index(Plug.Conn.t(), map) :: Plug.Conn.t() def index(conn, _params) do diff --git a/lib/teiserver_web/controllers/telemetry/infolog_controller.ex b/lib/teiserver_web/controllers/telemetry/infolog_controller.ex index 209679d33..98b7c35ac 100644 --- a/lib/teiserver_web/controllers/telemetry/infolog_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/infolog_controller.ex @@ -13,8 +13,8 @@ defmodule TeiserverWeb.Telemetry.InfologController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') - plug(:add_breadcrumb, name: 'Infologs', url: '/telemetry/infolog') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") + plug(:add_breadcrumb, name: "Infologs", url: "/telemetry/infolog") @spec index(Plug.Conn.t(), map) :: Plug.Conn.t() def index(conn, params) do diff --git a/lib/teiserver_web/controllers/telemetry/property_controller.ex b/lib/teiserver_web/controllers/telemetry/property_controller.ex index a078b8eb4..da24fb34f 100644 --- a/lib/teiserver_web/controllers/telemetry/property_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/property_controller.ex @@ -14,11 +14,11 @@ defmodule TeiserverWeb.Telemetry.PropertyController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") plug(:add_breadcrumb, - name: 'Client events', - url: '/teiserver/telemetry/complex_client_events/summary' + name: "Client events", + url: "/teiserver/telemetry/complex_client_events/summary" ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/controllers/telemetry/simple_client_event_controller.ex b/lib/teiserver_web/controllers/telemetry/simple_client_event_controller.ex index d67b3e7a6..cbb1ee583 100644 --- a/lib/teiserver_web/controllers/telemetry/simple_client_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/simple_client_event_controller.ex @@ -14,11 +14,11 @@ defmodule TeiserverWeb.Telemetry.SimpleClientEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") plug(:add_breadcrumb, - name: 'Simple client events', - url: '/telemetry/simple_client_events/summary' + name: "Simple client events", + url: "/telemetry/simple_client_events/summary" ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/controllers/telemetry/simple_lobby_event_controller.ex b/lib/teiserver_web/controllers/telemetry/simple_lobby_event_controller.ex index d794bb89c..3eec82d75 100644 --- a/lib/teiserver_web/controllers/telemetry/simple_lobby_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/simple_lobby_event_controller.ex @@ -14,9 +14,12 @@ defmodule TeiserverWeb.Telemetry.SimpleLobbyEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") - plug(:add_breadcrumb, name: 'Simple lobby events', url: '/telemetry/simple_lobby_events/summary') + plug(:add_breadcrumb, + name: "Simple lobby events", + url: "/telemetry/simple_lobby_events/summary" + ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() def summary(conn, params) do diff --git a/lib/teiserver_web/controllers/telemetry/simple_match_event_controller.ex b/lib/teiserver_web/controllers/telemetry/simple_match_event_controller.ex index c2c7fcb76..182df008f 100644 --- a/lib/teiserver_web/controllers/telemetry/simple_match_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/simple_match_event_controller.ex @@ -14,9 +14,12 @@ defmodule TeiserverWeb.Telemetry.SimpleMatchEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") - plug(:add_breadcrumb, name: 'Simple match events', url: '/telemetry/simple_match_events/summary') + plug(:add_breadcrumb, + name: "Simple match events", + url: "/telemetry/simple_match_events/summary" + ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() def summary(conn, params) do diff --git a/lib/teiserver_web/controllers/telemetry/simple_server_event_controller.ex b/lib/teiserver_web/controllers/telemetry/simple_server_event_controller.ex index dfe0ea413..b0128afb2 100644 --- a/lib/teiserver_web/controllers/telemetry/simple_server_event_controller.ex +++ b/lib/teiserver_web/controllers/telemetry/simple_server_event_controller.ex @@ -14,11 +14,11 @@ defmodule TeiserverWeb.Telemetry.SimpleServerEventController do action: {Phoenix.Controller, :action_name}, user: {Teiserver.Account.AuthLib, :current_user} - plug(:add_breadcrumb, name: 'Telemetry', url: '/telemetry') + plug(:add_breadcrumb, name: "Telemetry", url: "/telemetry") plug(:add_breadcrumb, - name: 'Simple server events', - url: '/telemetry/simple_server_events/summary' + name: "Simple server events", + url: "/telemetry/simple_server_events/summary" ) @spec summary(Plug.Conn.t(), map) :: Plug.Conn.t() diff --git a/lib/teiserver_web/gettext.ex b/lib/teiserver_web/gettext.ex index c9d50dc6a..d42d38230 100644 --- a/lib/teiserver_web/gettext.ex +++ b/lib/teiserver_web/gettext.ex @@ -20,5 +20,5 @@ defmodule TeiserverWeb.Gettext do See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ - use Gettext, otp_app: :teiserver + use Gettext.Backend, otp_app: :teiserver end diff --git a/lib/teiserver_web/teiserver_web.ex b/lib/teiserver_web/teiserver_web.ex index 5a5b8f80b..e3baec334 100644 --- a/lib/teiserver_web/teiserver_web.ex +++ b/lib/teiserver_web/teiserver_web.ex @@ -73,7 +73,7 @@ defmodule TeiserverWeb do import Teiserver.Config, only: [get_user_config_cache: 2, get_site_config_cache: 1] import TeiserverWeb.ErrorHelpers - import TeiserverWeb.Gettext + use Gettext, backend: TeiserverWeb.Gettext alias TeiserverWeb.Router.Helpers, as: Routes import Teiserver.Account.AuthLib, only: [allow?: 2, allow_any?: 2] diff --git a/lib/teiserver_web/templates/account/general/edit_details.html.heex b/lib/teiserver_web/templates/account/general/edit_details.html.heex index bdc8c9d9b..976efb0f8 100644 --- a/lib/teiserver_web/templates/account/general/edit_details.html.heex +++ b/lib/teiserver_web/templates/account/general/edit_details.html.heex @@ -25,7 +25,11 @@ <%= if Teiserver.Config.get_site_config_cache("user.Enable renames") do %>
<%= label(f, :name) %> - <%= text_input(f, :name, class: "form-control", required: "", autofocus: "autofocus") %> + <%= text_input(f, :name, + class: "form-control", + required: "", + autofocus: "autofocus" + ) %> <%= error_tag(f, :name) %>
<% else %> diff --git a/lib/teiserver_web/templates/component/icon_dropdown.html.heex b/lib/teiserver_web/templates/component/icon_dropdown.html.heex index 22550e110..06d969018 100644 --- a/lib/teiserver_web/templates/component/icon_dropdown.html.heex +++ b/lib/teiserver_web/templates/component/icon_dropdown.html.heex @@ -6,7 +6,7 @@ icons = if Map.has_key?(row, :icons), do: Enum.join(row.icons, ","), else: Map.get(row, :icon, "") %>