Merge pull request #285 from mdashlw/bump-max-sources

Bump max source count to 15
This commit is contained in:
liamwhite 2024-06-10 12:17:50 -04:00 committed by GitHub
commit 36efbd9eb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 3 deletions

View file

@ -937,7 +937,7 @@ defmodule Philomena.Images do
(source.sources ++ target.sources)
|> Enum.map(fn s -> %Source{image_id: target.id, source: s.source} end)
|> Enum.uniq()
|> Enum.take(10)
|> Enum.take(15)
target
|> Image.sources_changeset(sources)

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

View file

@ -8,7 +8,7 @@
p
'The page(s) you found this image on. Images may have a maximum of
span.js-max-source-count> 10
span.js-max-source-count> 15
' source URLs. Leave any sources you don't want to use blank.
= inputs_for f, :sources, [as: "image[old_sources]", skip_hidden: true], fn fs ->

View file

@ -40,7 +40,7 @@
h4 About this image
p
'The page(s) you found this image on. Images may have a maximum of
span.js-max-source-count> 10
span.js-max-source-count> 15
' source URLs. Leave any sources you don't want to use blank.
= inputs_for f, :sources, fn fs ->