Don't treat remote accepts/rejects as local.

Also, use specialized functions to get safe data.
This commit is contained in:
lain 2018-05-26 14:07:46 +02:00
commit 3839a11ef5
3 changed files with 42 additions and 6 deletions

View file

@ -95,6 +95,17 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
end
def reject(%{to: to, actor: actor, object: object} = params) do
# only accept false as false value
local = !(params[:local] == false)
with data <- %{"to" => to, "type" => "Reject", "actor" => actor, "object" => object},
{:ok, activity} <- insert(data, local),
:ok <- maybe_federate(activity) do
{:ok, activity}
end
end
def update(%{to: to, cc: cc, actor: actor, object: object} = params) do
# only accept false as false value
local = !(params[:local] == false)