From: Alexander Strizhakov Date: Wed, 12 Aug 2020 12:15:17 +0000 (+0300) Subject: don't expire pinned posts X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=eec1ba232c42285fc69c26b5ccc32c504955eab5;p=akkoma don't expire pinned posts --- diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 7d8f00b08..0142071a8 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -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()