Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85828576
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/pleroma/activity/pruner.ex b/lib/pleroma/activity/pruner.ex
index 0aad53aa9..082216f2f 100644
--- a/lib/pleroma/activity/pruner.ex
+++ b/lib/pleroma/activity/pruner.ex
@@ -1,43 +1,29 @@
defmodule Pleroma.Activity.Pruner do
@moduledoc """
Prunes activities from the database.
"""
alias Pleroma.Activity
alias Pleroma.Repo
import Ecto.Query
- def prune_deletes do
- before_time = cutoff()
-
- from(a in Activity,
- where: fragment("?->>'type' = ?", a.data, "Delete") and a.inserted_at < ^before_time
- )
- |> Repo.delete_all(timeout: :infinity)
- end
-
- def prune_undos do
- before_time = cutoff()
-
- from(a in Activity,
- where: fragment("?->>'type' = ?", a.data, "Undo") and a.inserted_at < ^before_time
- )
- |> Repo.delete_all(timeout: :infinity)
- end
+ def prune_deletes, do: prune("Delete")
+ def prune_undos, do: prune("Undo")
+ def prune_removes, do: prune("Remove")
- def prune_removes do
+ defp prune(activity_type) do
before_time = cutoff()
from(a in Activity,
- where: fragment("?->>'type' = ?", a.data, "Remove") and a.inserted_at < ^before_time
+ where: fragment("?->>'type' = ?", a.data, ^activity_type) and a.inserted_at < ^before_time
)
|> Repo.delete_all(timeout: :infinity)
end
defp cutoff do
deadline = Pleroma.Config.get([:instance, :remote_post_retention_days])
NaiveDateTime.utc_now()
|> NaiveDateTime.add(-(deadline * 86_400))
end
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Oct 31, 9:08 AM (19 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1801204
Default Alt Text
(1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline