Changelog + remove some unneeded comments from the tests

This commit is contained in:
ilja 2023-01-23 09:43:16 +01:00
parent c1c962e1a8
commit 328b4d93b7
2 changed files with 3 additions and 12 deletions

View file

@ -7,9 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased ## Unreleased
## Fixed ## Fixed
- Allowed contentMap to be updated on edit - Allowed contentMap to be updated on edit
### Added
- Extend the mix task `prune_objects` with option `--prune-orphaned-activities` to also prune orphaned activities, allowing to reclaim even more database space
## 2023.02 ## 2023.02
### Added ### Added

View file

@ -416,7 +416,6 @@ test "We don't have unexpected tables which may contain objects that are referen
end end
test "it prunes orphaned activities with the --prune-orphaned-activities" do test "it prunes orphaned activities with the --prune-orphaned-activities" do
# Add a remote activity which references an Object
%Object{} |> Map.merge(%{data: %{"id" => "object_for_activity"}}) |> Repo.insert() %Object{} |> Map.merge(%{data: %{"id" => "object_for_activity"}}) |> Repo.insert()
%Activity{} %Activity{}
@ -426,7 +425,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities" do
}) })
|> Repo.insert() |> Repo.insert()
# Add a remote activity which references an activity
%Activity{} %Activity{}
|> Map.merge(%{ |> Map.merge(%{
local: false, local: false,
@ -437,7 +435,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities" do
}) })
|> Repo.insert() |> Repo.insert()
# Add a remote activity which references an Actor
%User{} |> Map.merge(%{ap_id: "actor"}) |> Repo.insert() %User{} |> Map.merge(%{ap_id: "actor"}) |> Repo.insert()
%Activity{} %Activity{}
@ -447,7 +444,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities" do
}) })
|> Repo.insert() |> Repo.insert()
# Add a remote activity without existing referenced object, activity or actor
%Activity{} %Activity{}
|> Map.merge(%{ |> Map.merge(%{
local: false, local: false,
@ -458,7 +454,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities" do
}) })
|> Repo.insert() |> Repo.insert()
# Add a local activity without existing referenced object, activity or actor
%Activity{} %Activity{}
|> Map.merge(%{ |> Map.merge(%{
local: true, local: true,
@ -466,8 +461,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities" do
}) })
|> Repo.insert() |> Repo.insert()
# The remote activities without existing reference, and only the remote activities without existing reference, are deleted
# if, and only if, we provide the --prune-orphaned-activities option
assert length(Repo.all(Activity)) == 5 assert length(Repo.all(Activity)) == 5
Mix.Tasks.Pleroma.Database.run(["prune_objects"]) Mix.Tasks.Pleroma.Database.run(["prune_objects"])
assert length(Repo.all(Activity)) == 5 assert length(Repo.all(Activity)) == 5
@ -486,7 +479,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities when th
%Object{} |> Map.merge(%{data: %{"id" => "existing_object"}}) |> Repo.insert() %Object{} |> Map.merge(%{data: %{"id" => "existing_object"}}) |> Repo.insert()
%User{} |> Map.merge(%{ap_id: "existing_actor"}) |> Repo.insert() %User{} |> Map.merge(%{ap_id: "existing_actor"}) |> Repo.insert()
# Multiple objects, one object exists (keep)
%Activity{} %Activity{}
|> Map.merge(%{ |> Map.merge(%{
local: false, local: false,
@ -497,7 +489,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities when th
}) })
|> Repo.insert() |> Repo.insert()
# Multiple objects, one actor exists (keep)
%Activity{} %Activity{}
|> Map.merge(%{ |> Map.merge(%{
local: false, local: false,
@ -508,7 +499,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities when th
}) })
|> Repo.insert() |> Repo.insert()
# Multiple objects, one activity exists (keep)
%Activity{} %Activity{}
|> Map.merge(%{ |> Map.merge(%{
local: false, local: false,
@ -519,7 +509,6 @@ test "it prunes orphaned activities with the --prune-orphaned-activities when th
}) })
|> Repo.insert() |> Repo.insert()
# Multiple objects none exist (prune)
%Activity{} %Activity{}
|> Map.merge(%{ |> Map.merge(%{
local: false, local: false,