From f5642d1d3912ab4e2ea6ec7dde394f13f737a058 Mon Sep 17 00:00:00 2001 From: mdashlw Date: Sat, 23 Mar 2024 23:24:59 +0300 Subject: [PATCH] galleries: set actor child to the added image for notifications (#213) --- lib/philomena/galleries.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/philomena/galleries.ex b/lib/philomena/galleries.ex index 2b08e3e1..d3c060ce 100644 --- a/lib/philomena/galleries.ex +++ b/lib/philomena/galleries.ex @@ -203,7 +203,7 @@ defmodule Philomena.Galleries do |> case do {:ok, result} -> Images.reindex_image(image) - notify_gallery(gallery) + notify_gallery(gallery, image) reindex_gallery(gallery) {:ok, result} @@ -261,11 +261,11 @@ defmodule Philomena.Galleries do |> Repo.aggregate(:max, :position) end - def notify_gallery(gallery) do - Exq.enqueue(Exq, "notifications", NotificationWorker, ["Galleries", gallery.id]) + def notify_gallery(gallery, image) do + Exq.enqueue(Exq, "notifications", NotificationWorker, ["Galleries", [gallery.id, image.id]]) end - def perform_notify(gallery_id) do + def perform_notify([gallery_id, image_id]) do gallery = get_gallery!(gallery_id) subscriptions = @@ -279,8 +279,8 @@ defmodule Philomena.Galleries do %{ actor_id: gallery.id, actor_type: "Gallery", - actor_child_id: nil, - actor_child_type: nil, + actor_child_id: image_id, + actor_child_type: "Image", action: "added images to" } )