Only push to still valid websub subscriptions.
This commit is contained in:
parent
71cee07686
commit
0067c9d2be
1 changed files with 2 additions and 1 deletions
|
@ -49,7 +49,8 @@ defmodule Pleroma.Web.Websub do
|
||||||
def publish(topic, user, %{data: %{"type" => type}} = activity) when type in @supported_activities do
|
def publish(topic, user, %{data: %{"type" => type}} = activity) when type in @supported_activities do
|
||||||
# TODO: Only send to still valid subscriptions.
|
# TODO: Only send to still valid subscriptions.
|
||||||
query = from sub in WebsubServerSubscription,
|
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)
|
subscriptions = Repo.all(query)
|
||||||
Enum.each(subscriptions, fn(sub) ->
|
Enum.each(subscriptions, fn(sub) ->
|
||||||
response = user
|
response = user
|
||||||
|
|
Loading…
Reference in a new issue