fix tests (botched typespec & commission listing shenanigans)

This commit is contained in:
Luna D. 2024-06-23 15:10:18 +02:00
parent c8408376cc
commit f1b92ac25b
No known key found for this signature in database
GPG key ID: 4B1C63448394F688
2 changed files with 22 additions and 2 deletions

View file

@ -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",

View file

@ -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