mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-18 06:57:59 +01:00
Requires link to be origin/content-fanmade
Because OC owners be funny like that
This commit is contained in:
parent
a244b8d322
commit
8ba486b9ec
1 changed files with 10 additions and 0 deletions
|
@ -54,11 +54,21 @@ defmodule Philomena.ArtistLinks.ArtistLink do
|
||||||
|> validate_required([:user, :uri, :public])
|
|> validate_required([:user, :uri, :public])
|
||||||
|> validate_required([:tag], message: "must exist")
|
|> validate_required([:tag], message: "must exist")
|
||||||
|> validate_format(:uri, ~r|\Ahttps?://|)
|
|> validate_format(:uri, ~r|\Ahttps?://|)
|
||||||
|
|> validate_category()
|
||||||
|> parse_uri()
|
|> parse_uri()
|
||||||
|> put_verification_code()
|
|> put_verification_code()
|
||||||
|> put_next_check_at()
|
|> put_next_check_at()
|
||||||
end
|
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
|
def reject_changeset(artist_link) do
|
||||||
change(artist_link, aasm_state: "rejected")
|
change(artist_link, aasm_state: "rejected")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue