aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordtluna <dtluna@openmailbox.org>2017-06-20 17:57:04 +0300
committerdtluna <dtluna@openmailbox.org>2017-06-20 17:57:04 +0300
commitb76001ded34314b30da2fca94063fcecb0bed90f (patch)
tree279f0f12179d123ed07921d2840f032c420429fa /lib
parent08e53df91e1b52a36d557668d16afecc2eaa0a74 (diff)
parent07cee92cd4a28d4863dab6c8ccfd4cbfdd49b42a (diff)
downloadpleroma-b76001ded34314b30da2fca94063fcecb0bed90f.tar.gz
Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into develop
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/activity.ex7
-rw-r--r--lib/pleroma/web/websub/websub.ex8
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex
index d77c88997..40e14005b 100644
--- a/lib/pleroma/activity.ex
+++ b/lib/pleroma/activity.ex
@@ -12,16 +12,17 @@ defmodule Pleroma.Activity do
def get_by_ap_id(ap_id) do
Repo.one(from activity in Activity,
- where: fragment("? @> ?", activity.data, ^%{id: ap_id}))
+ where: fragment("(?)->>'id' = ?", activity.data, ^to_string(ap_id)))
end
def all_by_object_ap_id(ap_id) do
Repo.all(from activity in Activity,
- where: fragment("? @> ?", activity.data, ^%{object: %{id: ap_id}}))
+ where: fragment("(?)->'object'->>'id' = ?", activity.data, ^to_string(ap_id)))
end
def get_create_activity_by_object_ap_id(ap_id) do
Repo.one(from activity in Activity,
- where: fragment("? @> ?", activity.data, ^%{type: "Create", object: %{id: ap_id}}))
+ where: fragment("(?)->'object'->>'id' = ?", activity.data, ^to_string(ap_id))
+ and fragment("(?)->>'type' = 'Create'", activity.data))
end
end
diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex
index a683f6da4..12edf094c 100644
--- a/lib/pleroma/web/websub/websub.ex
+++ b/lib/pleroma/web/websub/websub.ex
@@ -53,10 +53,14 @@ defmodule Pleroma.Web.Websub do
Logger.debug(fn -> "Pushing to #{sub.callback}" end)
Task.start(fn ->
- @httpoison.post(sub.callback, response, [
+ with {:ok, %{status_code: code}} <- @httpoison.post(sub.callback, response, [
{"Content-Type", "application/atom+xml"},
{"X-Hub-Signature", "sha1=#{signature}"}
- ])
+ ]) do
+ Logger.debug(fn -> "Pushed to #{sub.callback}, code #{code}" end)
+ else e ->
+ Logger.debug(fn -> "Couldn't push to #{sub.callback}, #{inspect(e)}" end)
+ end
end)
end)
end