image: validate sources length

This commit is contained in:
mdashlw 2024-06-10 17:48:29 +03:00
parent 62a2f13bb6
commit 567eaac697
No known key found for this signature in database
GPG key ID: 0887AF18569DED32

View file

@ -212,11 +212,13 @@ defmodule Philomena.Images.Image do
image
|> cast(attrs, [])
|> SourceDiffer.diff_input(old_sources, new_sources)
|> validate_length(:sources, max: 15)
end
def sources_changeset(image, new_sources) do
change(image)
|> put_assoc(:sources, new_sources)
|> validate_length(:sources, max: 15)
end
def tag_changeset(image, attrs, old_tags, new_tags, excluded_tags \\ []) do