Only push to still valid websub subscriptions.
authorlain <lain@soykaf.club>
Tue, 13 Mar 2018 17:32:17 +0000 (18:32 +0100)
committerlain <lain@soykaf.club>
Tue, 13 Mar 2018 17:32:17 +0000 (18:32 +0100)
lib/pleroma/web/websub/websub.ex

index 47a01849df74bc8b5bec01ff4b66954f9e8cb752..fa3ab72141440277fcc1ac73fbcbe89fa2e6a36b 100644 (file)
@@ -49,7 +49,8 @@ defmodule Pleroma.Web.Websub do
   def publish(topic, user, %{data: %{"type" => type}} = activity) when type in @supported_activities do
     # TODO: Only send to still valid subscriptions.
     query = from sub in WebsubServerSubscription,
-    where: sub.topic == ^topic and sub.state == "active"
+      where: sub.topic == ^topic and sub.state == "active",
+      where: fragment("? > NOW()", sub.valid_until)
     subscriptions = Repo.all(query)
     Enum.each(subscriptions, fn(sub) ->
       response = user