Add notification checks
This commit is contained in:
parent
79910ce5cc
commit
007762e767
5 changed files with 28 additions and 7 deletions
|
|
@ -335,6 +335,22 @@ defmodule Pleroma.Web.CommonAPI.Utils do
|
|||
|
||||
def maybe_notify_mentioned_recipients(recipients, _), do: recipients
|
||||
|
||||
def maybe_notify_subscribers(
|
||||
recipients,
|
||||
%Activity{data: %{"actor" => actor, "type" => type}}
|
||||
) when type == "Create" do
|
||||
with %User{} = user <- User.get_by_ap_id(actor) do
|
||||
subscriber_ids =
|
||||
user
|
||||
|> User.subscribed_users()
|
||||
|> Enum.map(& &1.ap_id)
|
||||
|
||||
recipients ++ subscriber_ids
|
||||
end
|
||||
end
|
||||
|
||||
def maybe_notify_subscribers(recipients, _), do: recipients
|
||||
|
||||
def maybe_extract_mentions(%{"tag" => tag}) do
|
||||
tag
|
||||
|> Enum.filter(fn x -> is_map(x) end)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
def subscribe(%User{} = subscriber, params) do
|
||||
with {:ok, %User{} = subscribed} <- get_user(params) do
|
||||
User.subscribe(subscriber, subscribed)
|
||||
|> IO.inspect
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue