forked from AkkomaGang/akkoma
SideEffects: Use less cryptic syntax.
This commit is contained in:
parent
e62173dfc8
commit
1bcbdc7a9f
1 changed files with 9 additions and 7 deletions
|
@ -15,6 +15,7 @@ def handle(object, meta \\ [])
|
||||||
# - Add like to object
|
# - Add like to object
|
||||||
# - Set up notification
|
# - Set up notification
|
||||||
def handle(%{data: %{"type" => "Like"}} = object, meta) do
|
def handle(%{data: %{"type" => "Like"}} = object, meta) do
|
||||||
|
{:ok, result} =
|
||||||
Pleroma.Repo.transaction(fn ->
|
Pleroma.Repo.transaction(fn ->
|
||||||
liked_object = Object.get_by_ap_id(object.data["object"])
|
liked_object = Object.get_by_ap_id(object.data["object"])
|
||||||
Utils.add_like_to_object(object, liked_object)
|
Utils.add_like_to_object(object, liked_object)
|
||||||
|
@ -23,7 +24,8 @@ def handle(%{data: %{"type" => "Like"}} = object, meta) do
|
||||||
|
|
||||||
{:ok, object, meta}
|
{:ok, object, meta}
|
||||||
end)
|
end)
|
||||||
|> (fn {:ok, res} -> res end).()
|
|
||||||
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# Nothing to do
|
# Nothing to do
|
||||||
|
|
Loading…
Reference in a new issue