Insert object after being rewritten.
This commit is contained in:
parent
a7a40bb8f1
commit
4d55d7c95e
|
@ -20,8 +20,8 @@ def get_recipients(data) do
|
||||||
def insert(map, local \\ true) when is_map(map) do
|
def insert(map, local \\ true) when is_map(map) do
|
||||||
with nil <- Activity.get_by_ap_id(map["id"]),
|
with nil <- Activity.get_by_ap_id(map["id"]),
|
||||||
map <- lazy_put_activity_defaults(map),
|
map <- lazy_put_activity_defaults(map),
|
||||||
:ok <- insert_full_object(map),
|
{:ok, map} <- @rewrite_policy.filter(map),
|
||||||
{:ok, map} <- @rewrite_policy.filter(map) do
|
:ok <- insert_full_object(map) do
|
||||||
{:ok, activity} =
|
{:ok, activity} =
|
||||||
Repo.insert(%Activity{
|
Repo.insert(%Activity{
|
||||||
data: map,
|
data: map,
|
||||||
|
@ -313,7 +313,9 @@ defp restrict_recent(query, _) do
|
||||||
|
|
||||||
defp restrict_blocked(query, %{"blocking_user" => %User{info: info}}) do
|
defp restrict_blocked(query, %{"blocking_user" => %User{info: info}}) do
|
||||||
blocks = info["blocks"] || []
|
blocks = info["blocks"] || []
|
||||||
from(activity in query,
|
|
||||||
|
from(
|
||||||
|
activity in query,
|
||||||
where: fragment("not (? = ANY(?))", activity.actor, ^blocks),
|
where: fragment("not (? = ANY(?))", activity.actor, ^blocks),
|
||||||
where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks)
|
where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue