mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
update notification id immediately during merge transaction in case spawn off fails (fixes philomena-dev/philomena#70)
This commit is contained in:
parent
8bda69b22c
commit
ad1963e57c
1 changed files with 7 additions and 1 deletions
|
@ -18,6 +18,7 @@ defmodule Philomena.Images do
|
|||
alias Philomena.Images.ElasticsearchIndex, as: ImageIndex
|
||||
alias Philomena.ImageFeatures.ImageFeature
|
||||
alias Philomena.SourceChanges.SourceChange
|
||||
alias Philomena.Notifications.Notification
|
||||
alias Philomena.TagChanges.TagChange
|
||||
alias Philomena.Tags
|
||||
alias Philomena.UserStatistics
|
||||
|
@ -728,7 +729,12 @@ defmodule Philomena.Images do
|
|||
|> select([s], %{image_id: type(^target.id, :integer), user_id: s.user_id})
|
||||
|> Repo.all()
|
||||
|
||||
{count, nil} = Repo.insert_all(Subscription, subscriptions, on_conflict: :nothing)
|
||||
Repo.insert_all(Subscription, subscriptions, on_conflict: :nothing)
|
||||
|
||||
{count, nil} =
|
||||
Notification
|
||||
|> where(actor_type: "Image", actor_id: ^source.id)
|
||||
|> Repo.update_all(set: [actor_id: target.id])
|
||||
|
||||
{:ok, count}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue