drop affected notifications instead of moving them to the target (unique constraint violation)

This commit is contained in:
byte[] 2020-12-02 13:43:32 -05:00
parent 685159587c
commit 5e67e5aa14

View file

@ -734,7 +734,7 @@ defmodule Philomena.Images do
{count, nil} = {count, nil} =
Notification Notification
|> where(actor_type: "Image", actor_id: ^source.id) |> where(actor_type: "Image", actor_id: ^source.id)
|> Repo.update_all(set: [actor_id: target.id]) |> Repo.delete_all()
{:ok, count} {:ok, count}
end end