refactor(database): reuse retention query in prune_objects
prune_objects --keep-threads now shares the thread selection with Pleroma.Retention, which additionally keeps threads that mention a local user or that are referenced by a report. The hashtag cleanup is shared as well.
This commit is contained in:
parent
cd796f007d
commit
fa4fb00910
2 changed files with 24 additions and 41 deletions
|
|
@ -200,6 +200,23 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
|
|||
refute Object.get_by_ap_id(old_remote_post2_id)
|
||||
end
|
||||
|
||||
test "with the --keep-threads option it keeps old threads that mentioned a local user", %{
|
||||
old_insert_date: old_insert_date
|
||||
} do
|
||||
remote_user = insert(:user, local: false)
|
||||
local_user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(remote_user, %{status: "hey @#{local_user.nickname}"})
|
||||
|
||||
activity
|
||||
|> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date})
|
||||
|> Repo.update!()
|
||||
|
||||
Mix.Tasks.Pleroma.Database.run(["prune_objects", "--keep-threads"])
|
||||
|
||||
assert Object.get_by_ap_id(activity.data["object"])
|
||||
end
|
||||
|
||||
test "with the --keep-threads option it still keeps non-old threads even with no local interactions" do
|
||||
remote_user = insert(:user, local: false)
|
||||
remote_user2 = insert(:user, local: false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue