From c585f9e26ca81f0394cf3fc1a9271833506811e1 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sat, 22 Apr 2017 13:48:10 +0200 Subject: [PATCH] Only handle subscription requests for now. --- lib/pleroma/web/websub/websub.ex | 2 +- test/web/websub/websub_controller_test.exs | 2 +- test/web/websub/websub_test.exs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex index 50878e3c4..cf819afd1 100644 --- a/lib/pleroma/web/websub/websub.ex +++ b/lib/pleroma/web/websub/websub.ex @@ -52,7 +52,7 @@ def publish(topic, user, activity) do end) end - def incoming_subscription_request(user, params) do + def incoming_subscription_request(user, %{"hub.mode" => "subscribe"} = params) do with {:ok, topic} <- valid_topic(params, user), {:ok, lease_time} <- lease_time(params), secret <- params["hub.secret"], diff --git a/test/web/websub/websub_controller_test.exs b/test/web/websub/websub_controller_test.exs index 9a0a5c61b..8368cafea 100644 --- a/test/web/websub/websub_controller_test.exs +++ b/test/web/websub/websub_controller_test.exs @@ -9,7 +9,7 @@ test "websub subscription request", %{conn: conn} do data = %{ "hub.callback": "http://example.org/sub", - "hub.mode": "subscription", + "hub.mode": "subscribe", "hub.topic": Pleroma.Web.OStatus.feed_path(user), "hub.secret": "a random secret", "hub.lease_seconds": "100" diff --git a/test/web/websub/websub_test.exs b/test/web/websub/websub_test.exs index 5fe91d0f8..334ba03fc 100644 --- a/test/web/websub/websub_test.exs +++ b/test/web/websub/websub_test.exs @@ -52,7 +52,7 @@ test "an incoming subscription request" do data = %{ "hub.callback" => "http://example.org/sub", - "hub.mode" => "subscription", + "hub.mode" => "subscribe", "hub.topic" => Pleroma.Web.OStatus.feed_path(user), "hub.secret" => "a random secret", "hub.lease_seconds" => "100" @@ -72,7 +72,7 @@ test "an incoming subscription request for an existing subscription" do data = %{ "hub.callback" => sub.callback, - "hub.mode" => "subscription", + "hub.mode" => "subscribe", "hub.topic" => Pleroma.Web.OStatus.feed_path(user), "hub.secret" => "a random secret", "hub.lease_seconds" => "100"