projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Excoveralls for code coverage
[akkoma]
/
lib
/
pleroma
/
activity.ex
diff --git
a/lib/pleroma/activity.ex
b/lib/pleroma/activity.ex
index c121e800f6c206ca3bfd989282965d42ffd30029..4a09194786f3f58ca4c998fd67d99cb0a8dc4f40 100644
(file)
--- a/
lib/pleroma/activity.ex
+++ b/
lib/pleroma/activity.ex
@@
-132,7
+132,10
@@
defmodule Pleroma.Activity do
end
def get_by_id(id) do
end
def get_by_id(id) do
- Repo.get(Activity, id)
+ Activity
+ |> where([a], a.id == ^id)
+ |> restrict_deactivated_users()
+ |> Repo.one()
end
def get_by_id_with_object(id) do
end
def get_by_id_with_object(id) do
@@
-200,6
+203,7
@@
defmodule Pleroma.Activity do
def get_create_by_object_ap_id(ap_id) when is_binary(ap_id) do
create_by_object_ap_id(ap_id)
def get_create_by_object_ap_id(ap_id) when is_binary(ap_id) do
create_by_object_ap_id(ap_id)
+ |> restrict_deactivated_users()
|> Repo.one()
end
|> Repo.one()
end
@@
-314,4
+318,14
@@
defmodule Pleroma.Activity do
def query_by_actor(actor) do
from(a in Activity, where: a.actor == ^actor)
end
def query_by_actor(actor) do
from(a in Activity, where: a.actor == ^actor)
end
+
+ def restrict_deactivated_users(query) do
+ from(activity in query,
+ where:
+ fragment(
+ "? not in (SELECT ap_id FROM users WHERE info->'deactivated' @> 'true')",
+ activity.actor
+ )
+ )
+ end
end
end