Only handle subscription requests for now.

This commit is contained in:
Roger Braun 2017-04-22 13:48:10 +02:00
parent 8fb73c28bb
commit c585f9e26c
3 changed files with 4 additions and 4 deletions

View file

@ -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"],

View file

@ -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"

View file

@ -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"