mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
re-add merge notification
This commit is contained in:
parent
ea424ac83b
commit
11276b2339
1 changed files with 22 additions and 0 deletions
|
@ -427,6 +427,7 @@ defmodule Philomena.Images do
|
|||
{:ok, result} ->
|
||||
reindex_image(duplicate_of_image)
|
||||
Comments.reindex_comments(duplicate_of_image)
|
||||
notify_merge(image, duplicate_of_image)
|
||||
|
||||
{:ok, result}
|
||||
|
||||
|
@ -742,6 +743,27 @@ defmodule Philomena.Images do
|
|||
{:ok, count}
|
||||
end
|
||||
|
||||
def notify_merge(source, target) do
|
||||
spawn(fn ->
|
||||
subscriptions =
|
||||
target
|
||||
|> Repo.preload(:subscriptions)
|
||||
|> Map.fetch!(:subscriptions)
|
||||
|
||||
Notifications.notify(
|
||||
nil,
|
||||
subscriptions,
|
||||
%{
|
||||
actor_id: target.id,
|
||||
actor_type: "Image",
|
||||
actor_child_id: nil,
|
||||
actor_child_type: nil,
|
||||
action: "merged ##{source.id} into"
|
||||
}
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
def clear_notification(_image, nil), do: nil
|
||||
|
||||
def clear_notification(image, user) do
|
||||
|
|
Loading…
Reference in a new issue