From 328b4d93b750f181966b08bff048f0912e2ad6b3 Mon Sep 17 00:00:00 2001 From: ilja Date: Mon, 23 Jan 2023 09:43:16 +0100 Subject: [PATCH] Changelog + remove some unneeded comments from the tests --- CHANGELOG.md | 4 +++- test/mix/tasks/pleroma/database_test.exs | 11 ----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1da10fae4..0295b1860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased ## Fixed - - 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 ### Added diff --git a/test/mix/tasks/pleroma/database_test.exs b/test/mix/tasks/pleroma/database_test.exs index 402856f3d..9edb2c115 100644 --- a/test/mix/tasks/pleroma/database_test.exs +++ b/test/mix/tasks/pleroma/database_test.exs @@ -416,7 +416,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do end 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() %Activity{} @@ -426,7 +425,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> Repo.insert() - # Add a remote activity which references an activity %Activity{} |> Map.merge(%{ local: false, @@ -437,7 +435,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> Repo.insert() - # Add a remote activity which references an Actor %User{} |> Map.merge(%{ap_id: "actor"}) |> Repo.insert() %Activity{} @@ -447,7 +444,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> Repo.insert() - # Add a remote activity without existing referenced object, activity or actor %Activity{} |> Map.merge(%{ local: false, @@ -458,7 +454,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> Repo.insert() - # Add a local activity without existing referenced object, activity or actor %Activity{} |> Map.merge(%{ local: true, @@ -466,8 +461,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> 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 Mix.Tasks.Pleroma.Database.run(["prune_objects"]) assert length(Repo.all(Activity)) == 5 @@ -486,7 +479,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do %Object{} |> Map.merge(%{data: %{"id" => "existing_object"}}) |> Repo.insert() %User{} |> Map.merge(%{ap_id: "existing_actor"}) |> Repo.insert() - # Multiple objects, one object exists (keep) %Activity{} |> Map.merge(%{ local: false, @@ -497,7 +489,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> Repo.insert() - # Multiple objects, one actor exists (keep) %Activity{} |> Map.merge(%{ local: false, @@ -508,7 +499,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> Repo.insert() - # Multiple objects, one activity exists (keep) %Activity{} |> Map.merge(%{ local: false, @@ -519,7 +509,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do }) |> Repo.insert() - # Multiple objects none exist (prune) %Activity{} |> Map.merge(%{ local: false, -- 2.45.2