From f1b92ac25b9236cf276028270645973d69c9c091 Mon Sep 17 00:00:00 2001 From: "Luna D." Date: Sun, 23 Jun 2024 15:10:18 +0200 Subject: [PATCH] fix tests (botched typespec & commission listing shenanigans) --- lib/philomena/commissions/commission.ex | 22 ++++++++++++++++++- .../plugs/moderation_log_plug.ex | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/philomena/commissions/commission.ex b/lib/philomena/commissions/commission.ex index d8afead4..2e800ccb 100644 --- a/lib/philomena/commissions/commission.ex +++ b/lib/philomena/commissions/commission.ex @@ -42,7 +42,7 @@ defmodule Philomena.Commissions.Commission do |> validate_length(:contact, max: 1000, count: :bytes) |> validate_length(:will_create, max: 1000, count: :bytes) |> validate_length(:will_not_create, max: 1000, count: :bytes) - |> validate_subset(:categories, Keyword.values(categories())) + |> validate_subset(:categories, category_values()) end defp drop_blank_categories(changeset) do @@ -72,6 +72,26 @@ defmodule Philomena.Commissions.Commission do ] end + # This is probably not the best way to do this, + # but I need dialyzer to shut up and do so fast. + def category_values do + [ + "Anthro", + "Canon Characters", + "Comics", + "Fetish Art", + "Human and Human-like", + "NSFW", + "Original Characters", + "Original Species", + "Non-Humanoid", + "Requests", + "Safe", + "Shipping", + "Violence and Gore" + ] + end + def types do [ "Sketch", diff --git a/lib/philomena_web/plugs/moderation_log_plug.ex b/lib/philomena_web/plugs/moderation_log_plug.ex index c29f45a5..e69da570 100644 --- a/lib/philomena_web/plugs/moderation_log_plug.ex +++ b/lib/philomena_web/plugs/moderation_log_plug.ex @@ -17,7 +17,7 @@ defmodule PhilomenaWeb.ModerationLogPlug do def init(opts), do: opts @type log_details :: %{subject_path: String.t(), body: String.t()} - @type details_func :: (Plug.Conn.t(), atom(), any() -> log_details()) + @type details_func :: (atom(), any() -> log_details()) @type call_opts :: [details: details_func, data: any()] @doc false