Merge branch 'worker-messages' into 'develop'
Worker messages Closes #1705 See merge request pleroma/pleroma!2410
This commit is contained in:
commit
2e73c19edc
4 changed files with 18 additions and 9 deletions
|
|
@ -72,19 +72,24 @@ defmodule Pleroma.Web.Federator do
|
|||
# actor shouldn't be acting on objects outside their own AP server.
|
||||
with {:ok, _user} <- ap_enabled_actor(params["actor"]),
|
||||
nil <- Activity.normalize(params["id"]),
|
||||
:ok <- Containment.contain_origin_from_id(params["actor"], params),
|
||||
{_, :ok} <-
|
||||
{:correct_origin?, Containment.contain_origin_from_id(params["actor"], params)},
|
||||
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
|
||||
{:ok, activity}
|
||||
else
|
||||
{:correct_origin?, _} ->
|
||||
Logger.debug("Origin containment failure for #{params["id"]}")
|
||||
{:error, :origin_containment_failed}
|
||||
|
||||
%Activity{} ->
|
||||
Logger.debug("Already had #{params["id"]}")
|
||||
:error
|
||||
{:error, :already_present}
|
||||
|
||||
_e ->
|
||||
e ->
|
||||
# Just drop those for now
|
||||
Logger.debug("Unhandled activity")
|
||||
Logger.debug(Jason.encode!(params, pretty: true))
|
||||
:error
|
||||
{:error, e}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -55,11 +55,12 @@ defmodule Pleroma.Web.Push.Impl do
|
|||
|> Jason.encode!()
|
||||
|> push_message(build_sub(subscription), gcm_api_key, subscription)
|
||||
end
|
||||
|> (&{:ok, &1}).()
|
||||
end
|
||||
|
||||
def perform(_) do
|
||||
Logger.warn("Unknown notification type")
|
||||
:error
|
||||
{:error, :unknown_type}
|
||||
end
|
||||
|
||||
@doc "Push message to web"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue