Fix update_in for Image

This commit is contained in:
byte[] 2021-10-10 08:27:39 -04:00 committed by Luna D
parent cb1d2b97ff
commit a1f98e95a1
No known key found for this signature in database
GPG key ID: 4B1C63448394F688

View file

@ -80,8 +80,7 @@ defmodule PhilomenaWeb.ImageController do
|> Comments.change_comment()
image_changeset =
image
|> update_in([:sources], &sources_for_edit/1)
%{image | sources: sources_for_edit(image.sources)}
|> Images.change_image()
watching = Images.subscribed?(image, conn.assigns.current_user)
@ -222,5 +221,5 @@ defmodule PhilomenaWeb.ImageController do
defp sources_for_edit(), do: [%Source{}]
defp sources_for_edit([]), do: sources_for_edit()
defp source_for_edit(sources), do: sources
defp sources_for_edit(sources), do: sources
end