Requires link to be origin/content-fanmade

Because OC owners be funny like that
This commit is contained in:
Parasprite 2020-11-26 12:35:25 -06:00 committed by byte[]
parent a244b8d322
commit 8ba486b9ec

View file

@ -54,11 +54,21 @@ defmodule Philomena.ArtistLinks.ArtistLink do
|> validate_required([:user, :uri, :public])
|> validate_required([:tag], message: "must exist")
|> validate_format(:uri, ~r|\Ahttps?://|)
|> validate_category()
|> parse_uri()
|> put_verification_code()
|> put_next_check_at()
end
def validate_category(changeset) do
tag = get_field(changeset, :tag)
case tag.category in ["origin", "content-fanmade"] do
false -> add_error(changeset, :tag, "must be a creator tag")
true -> changeset
end
end
def reject_changeset(artist_link) do
change(artist_link, aasm_state: "rejected")
end