Merge remote-tracking branch 'origin/feature/bounded-retention' into shigusegubu-new
This commit is contained in:
commit
d9e75192ad
13 changed files with 1340 additions and 42 deletions
|
|
@ -200,6 +200,58 @@ 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 a local user quoted", %{
|
||||
old_insert_date: old_insert_date
|
||||
} do
|
||||
remote_user = insert(:user, local: false)
|
||||
local_user = insert(:user)
|
||||
|
||||
{:ok, quoted} = CommonAPI.post(remote_user, %{status: "quote me"})
|
||||
|
||||
quoted
|
||||
|> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date})
|
||||
|> Repo.update!()
|
||||
|
||||
{:ok, quote} = CommonAPI.post(local_user, %{status: "look", quote_id: quoted.id})
|
||||
|
||||
quote
|
||||
|> Ecto.Changeset.change(%{updated_at: old_insert_date})
|
||||
|> Repo.update!()
|
||||
|
||||
Mix.Tasks.Pleroma.Database.run(["prune_objects", "--keep-threads"])
|
||||
|
||||
assert Object.get_by_ap_id(quoted.data["object"])
|
||||
end
|
||||
|
||||
test "with the --keep-threads option it keeps old threads addressed to a local user", %{
|
||||
old_insert_date: old_insert_date
|
||||
} do
|
||||
remote_user = insert(:user, local: false)
|
||||
local_user = insert(:user)
|
||||
|
||||
{:ok, mention} = CommonAPI.post(remote_user, %{status: "hey @#{local_user.nickname}"})
|
||||
|
||||
{:ok, dm} =
|
||||
CommonAPI.post(remote_user, %{
|
||||
status: "psst @#{local_user.nickname}",
|
||||
visibility: "direct"
|
||||
})
|
||||
|
||||
# The pin must not depend on the notifications still being there
|
||||
Pleroma.Notification.clear(local_user)
|
||||
|
||||
for activity <- [mention, dm] do
|
||||
activity
|
||||
|> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date})
|
||||
|> Repo.update!()
|
||||
end
|
||||
|
||||
Mix.Tasks.Pleroma.Database.run(["prune_objects", "--keep-threads"])
|
||||
|
||||
assert Object.get_by_ap_id(mention.data["object"])
|
||||
assert Object.get_by_ap_id(dm.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)
|
||||
|
|
@ -407,6 +459,7 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
|
|||
["push_subscriptions"],
|
||||
["registrations"],
|
||||
["report_notes"],
|
||||
["retention_cursors"],
|
||||
["rich_media_card"],
|
||||
["rules"],
|
||||
["scheduled_activities"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue