fix(retention): keep threads whose post a local user quoted
A quote has a context of its own, so the quoted remote thread counted as untouched and was evicted, breaking the local quote. On lain.com 45 of 134 quoted posts went this way. The objects_quote_url index keeps the lookup at one probe per post.
This commit is contained in:
parent
5e425ce9f5
commit
e93f05a79f
5 changed files with 53 additions and 5 deletions
|
|
@ -18,6 +18,7 @@ defmodule Pleroma.Retention do
|
|||
users all carry the thread's context),
|
||||
* is bookmarked by a local user,
|
||||
* is addressed to a local user (direct messages and mentions),
|
||||
* is a post quoted by a local post,
|
||||
* still has a notification for a local user,
|
||||
* is a report (Flag),
|
||||
|
||||
|
|
@ -245,6 +246,18 @@ defmodule Pleroma.Retention do
|
|||
^local_prefix()
|
||||
)
|
||||
)
|
||||
# A local quote has a context of its own, so look up quotes of the posts
|
||||
# here; the objects_quote_url index is on the jsonb value.
|
||||
|> having(
|
||||
[a],
|
||||
not fragment(
|
||||
"bool_or(? ->> 'type' = 'Create' AND EXISTS (SELECT 1 FROM objects q WHERE q.data -> 'quoteUrl' = to_jsonb(associated_object_id(?)) AND left(q.data ->> 'actor', ?) = ?))",
|
||||
a.data,
|
||||
a.data,
|
||||
^local_prefix_length(),
|
||||
^local_prefix()
|
||||
)
|
||||
)
|
||||
|> maybe_keep_non_public(Keyword.get(opts, :keep_non_public, false) == true)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue