constants: add as_public constant and use it everywhere
This commit is contained in:
parent
9d78b3b281
commit
b93498eb52
26 changed files with 104 additions and 89 deletions
|
|
@ -8,6 +8,7 @@ defmodule Mix.Tasks.Pleroma.Database do
|
|||
alias Pleroma.Repo
|
||||
alias Pleroma.User
|
||||
require Logger
|
||||
require Pleroma.Constants
|
||||
import Mix.Pleroma
|
||||
use Mix.Task
|
||||
|
||||
|
|
@ -99,10 +100,15 @@ defmodule Mix.Tasks.Pleroma.Database do
|
|||
NaiveDateTime.utc_now()
|
||||
|> NaiveDateTime.add(-(deadline * 86_400))
|
||||
|
||||
public = "https://www.w3.org/ns/activitystreams#Public"
|
||||
|
||||
from(o in Object,
|
||||
where: fragment("?->'to' \\? ? OR ?->'cc' \\? ?", o.data, ^public, o.data, ^public),
|
||||
where:
|
||||
fragment(
|
||||
"?->'to' \\? ? OR ?->'cc' \\? ?",
|
||||
o.data,
|
||||
^Pleroma.Constants.as_public(),
|
||||
o.data,
|
||||
^Pleroma.Constants.as_public()
|
||||
),
|
||||
where: o.inserted_at < ^time_deadline,
|
||||
where:
|
||||
fragment("split_part(?->>'actor', '/', 3) != ?", o.data, ^Pleroma.Web.Endpoint.host())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue