From a1f98e95a17a32b571f0512a1da787b6c3c4088a Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sun, 10 Oct 2021 08:27:39 -0400 Subject: [PATCH] Fix update_in for Image --- lib/philomena_web/controllers/image_controller.ex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/philomena_web/controllers/image_controller.ex b/lib/philomena_web/controllers/image_controller.ex index 4c6e5b8b..fe194767 100644 --- a/lib/philomena_web/controllers/image_controller.ex +++ b/lib/philomena_web/controllers/image_controller.ex @@ -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