Extract note handler.
[akkoma] / lib / pleroma / web / websub / websub.ex
index 5468758fd36e41326d1b51db8db86d8a918d45e4..e46e0a2ce19082c9e3f718f367d1f5912e8cae75 100644 (file)
@@ -39,6 +39,7 @@ defmodule Pleroma.Web.Websub do
   end
 
   def publish(topic, user, activity) do
+    # TODO: Only send to still valid subscriptions.
     query = from sub in WebsubServerSubscription,
     where: sub.topic == ^topic and sub.state == "active"
     subscriptions = Repo.all(query)
@@ -211,7 +212,7 @@ defmodule Pleroma.Web.Websub do
     cut_off = NaiveDateTime.add(NaiveDateTime.utc_now, delta)
 
     query = from sub in WebsubClientSubscription,
-      where: sub.valid_until < ^cut_off and sub.state == "active"
+      where: sub.valid_until < ^cut_off and sub.state == "accepted"
 
     subs = Repo.all(query)