Merge branch 'bugfix/1629-fav-race-condition' into 'develop'
SideEffects: Run in transaction. Closes #1629 See merge request pleroma/pleroma!2417
This commit is contained in:
commit
850377a7b8
2 changed files with 36 additions and 4 deletions
|
|
@ -15,12 +15,17 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
# - Add like to object
|
||||
# - Set up notification
|
||||
def handle(%{data: %{"type" => "Like"}} = object, meta) do
|
||||
liked_object = Object.get_by_ap_id(object.data["object"])
|
||||
Utils.add_like_to_object(object, liked_object)
|
||||
{:ok, result} =
|
||||
Pleroma.Repo.transaction(fn ->
|
||||
liked_object = Object.get_by_ap_id(object.data["object"])
|
||||
Utils.add_like_to_object(object, liked_object)
|
||||
|
||||
Notification.create_notifications(object)
|
||||
Notification.create_notifications(object)
|
||||
|
||||
{:ok, object, meta}
|
||||
{:ok, object, meta}
|
||||
end)
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
# Nothing to do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue