mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
image: validate sources length
This commit is contained in:
parent
62a2f13bb6
commit
567eaac697
1 changed files with 2 additions and 0 deletions
|
@ -212,11 +212,13 @@ defmodule Philomena.Images.Image do
|
||||||
image
|
image
|
||||||
|> cast(attrs, [])
|
|> cast(attrs, [])
|
||||||
|> SourceDiffer.diff_input(old_sources, new_sources)
|
|> SourceDiffer.diff_input(old_sources, new_sources)
|
||||||
|
|> validate_length(:sources, max: 15)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sources_changeset(image, new_sources) do
|
def sources_changeset(image, new_sources) do
|
||||||
change(image)
|
change(image)
|
||||||
|> put_assoc(:sources, new_sources)
|
|> put_assoc(:sources, new_sources)
|
||||||
|
|> validate_length(:sources, max: 15)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_changeset(image, attrs, old_tags, new_tags, excluded_tags \\ []) do
|
def tag_changeset(image, attrs, old_tags, new_tags, excluded_tags \\ []) do
|
||||||
|
|
Loading…
Reference in a new issue