don't expire pinned posts

This commit is contained in:
Alexander Strizhakov 2020-08-12 15:15:17 +03:00
parent 57b455de5a
commit eec1ba232c
No known key found for this signature in database
GPG key ID: 022896A53AEF1381

View file

@ -150,8 +150,12 @@ defmodule Mix.Tasks.Pleroma.Database do
|> Pleroma.RepoStreamer.chunk_stream(100)
|> Stream.each(fn activities ->
Enum.each(activities, fn activity ->
expires_at = Timex.shift(activity.inserted_at, days: days)
Pleroma.ActivityExpiration.create(activity, expires_at, false)
user = User.get_cached_by_ap_id(activity.actor)
if activity.id not in user.pinned_activities do
expires_at = Timex.shift(activity.inserted_at, days: days)
Pleroma.ActivityExpiration.create(activity, expires_at, false)
end
end)
end)
|> Stream.run()