use Kernel.put_in instead of Map.merge
authorRin Toshaka <rinpatch@sdf.org>
Sat, 29 Dec 2018 20:50:34 +0000 (21:50 +0100)
committerRin Toshaka <rinpatch@sdf.org>
Sat, 29 Dec 2018 20:50:34 +0000 (21:50 +0100)
lib/pleroma/web/common_api/utils.ex

index 5c37fd6710db97c4392722b273c2ddaf9d7b4014..7b11bc3edad2d731625ecb9cc9c470425e5b571f 100644 (file)
@@ -300,17 +300,19 @@ defmodule Pleroma.Web.CommonAPI.Utils do
     if !(new_scrubber_cache == scrubber_cache) or scrubbed_html == nil do
       scrubbed_html = HTML.filter_tags(content, scrubbers)
       new_scrubber_cache = [%{:scrubbers => key, :content => scrubbed_html} | new_scrubber_cache]
+      IO.puts(activity)
 
       activity =
-        Map.merge(activity, %{
-          data: %{"object" => %{"scrubber_cache" => new_scrubber_cache}}
-        })
+        Map.put(
+          activity,
+          :data,
+          Kernel.put_in(activity.data, ["object", "scrubber_cache"], new_scrubber_cache)
+        )
 
       cng = Ecto.Changeset.change(activity)
       Repo.update(cng)
       scrubbed_html
     else
-      IO.puts("got the post from cache")
       scrubbed_html
     end
   end