projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
activitypub: transmogrifier: unify mention extraction
[akkoma]
/
lib
/
pleroma
/
user.ex
diff --git
a/lib/pleroma/user.ex
b/lib/pleroma/user.ex
index b2f59ab6b61abc7a55df3fdd533a52c317635d85..260d904bcf65bd59800ac9572de8a80a598b3bd4 100644
(file)
--- a/
lib/pleroma/user.ex
+++ b/
lib/pleroma/user.ex
@@
-464,15
+464,28
@@
defmodule Pleroma.User do
update_and_set_cache(cs)
end
update_and_set_cache(cs)
end
- def get_notified_from_activity_query(to) do
+ def get_notified_from_activity_query(to
, false
) do
from(
u in User,
from(
u in User,
- where: u.ap_id in ^to,
+ where: u.ap_id in ^to
+ )
+ end
+
+ def get_notified_from_activity_query(to, true) do
+ query = get_notified_from_activity_query(to, false)
+
+ from(
+ u in query,
where: u.local == true
)
end
where: u.local == true
)
end
- def get_notified_from_activity(%Activity{recipients: to, data: %{"type" => "Announce"} = data}) do
+ def get_notified_from_activity(activity, local_only \\ true)
+
+ def get_notified_from_activity(
+ %Activity{data: %{"type" => "Announce", "to" => to} = data},
+ local_only
+ ) do
object = Object.normalize(data["object"])
actor = User.get_cached_by_ap_id(data["actor"])
object = Object.normalize(data["object"])
actor = User.get_cached_by_ap_id(data["actor"])
@@
-485,17
+498,19
@@
defmodule Pleroma.User do
end
|> Enum.uniq()
end
|> Enum.uniq()
- query = get_notified_from_activity_query(to)
+ query = get_notified_from_activity_query(to
, local_only
)
Repo.all(query)
end
Repo.all(query)
end
- def get_notified_from_activity(%Activity{
recipients: to}
) do
- query = get_notified_from_activity_query(to)
+ def get_notified_from_activity(%Activity{
data: %{"to" => to}}, local_only
) do
+ query = get_notified_from_activity_query(to
, local_only
)
Repo.all(query)
end
Repo.all(query)
end
+ def get_notified_from_activity(_, _), do: []
+
def get_recipients_from_activity(%Activity{recipients: to}) do
query =
from(
def get_recipients_from_activity(%Activity{recipients: to}) do
query =
from(