mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
galleries: set actor child to the added image for notifications (#213)
This commit is contained in:
parent
2dae9118c7
commit
f5642d1d39
1 changed files with 6 additions and 6 deletions
|
@ -203,7 +203,7 @@ defmodule Philomena.Galleries do
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, result} ->
|
{:ok, result} ->
|
||||||
Images.reindex_image(image)
|
Images.reindex_image(image)
|
||||||
notify_gallery(gallery)
|
notify_gallery(gallery, image)
|
||||||
reindex_gallery(gallery)
|
reindex_gallery(gallery)
|
||||||
|
|
||||||
{:ok, result}
|
{:ok, result}
|
||||||
|
@ -261,11 +261,11 @@ defmodule Philomena.Galleries do
|
||||||
|> Repo.aggregate(:max, :position)
|
|> Repo.aggregate(:max, :position)
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_gallery(gallery) do
|
def notify_gallery(gallery, image) do
|
||||||
Exq.enqueue(Exq, "notifications", NotificationWorker, ["Galleries", gallery.id])
|
Exq.enqueue(Exq, "notifications", NotificationWorker, ["Galleries", [gallery.id, image.id]])
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform_notify(gallery_id) do
|
def perform_notify([gallery_id, image_id]) do
|
||||||
gallery = get_gallery!(gallery_id)
|
gallery = get_gallery!(gallery_id)
|
||||||
|
|
||||||
subscriptions =
|
subscriptions =
|
||||||
|
@ -279,8 +279,8 @@ defmodule Philomena.Galleries do
|
||||||
%{
|
%{
|
||||||
actor_id: gallery.id,
|
actor_id: gallery.id,
|
||||||
actor_type: "Gallery",
|
actor_type: "Gallery",
|
||||||
actor_child_id: nil,
|
actor_child_id: image_id,
|
||||||
actor_child_type: nil,
|
actor_child_type: "Image",
|
||||||
action: "added images to"
|
action: "added images to"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue