diff --git a/lib/philomena/images.ex b/lib/philomena/images.ex index 95788ad5..d68595fb 100644 --- a/lib/philomena/images.ex +++ b/lib/philomena/images.ex @@ -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) diff --git a/lib/philomena/images/image.ex b/lib/philomena/images/image.ex index d8e791c8..7b808eaa 100644 --- a/lib/philomena/images/image.ex +++ b/lib/philomena/images/image.ex @@ -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 diff --git a/lib/philomena_web/templates/image/_source.html.slime b/lib/philomena_web/templates/image/_source.html.slime index 8fa32872..48e3c6de 100644 --- a/lib/philomena_web/templates/image/_source.html.slime +++ b/lib/philomena_web/templates/image/_source.html.slime @@ -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 -> diff --git a/lib/philomena_web/templates/image/new.html.slime b/lib/philomena_web/templates/image/new.html.slime index ad596f17..dfb664d9 100644 --- a/lib/philomena_web/templates/image/new.html.slime +++ b/lib/philomena_web/templates/image/new.html.slime @@ -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 ->