From 7edf9b0e434e1946bb492d26e06f80347f9f9e42 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 26 Oct 2024 00:59:26 +0300 Subject: [PATCH] dont delete the drafts themselves: -- ppl can unabandon their effortposts more than 6 months later -- ppl cant see their deleted content on wpd --- files/helpers/cron.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index fc2d76b45..209064718 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -450,21 +450,19 @@ def _cleanup_videos(): ) for post in unpublished_drafts: print(f'draft post: {post.id}', flush=True) - post.deleted_utc = time.time() - g.db.add(post) for media_usage in post.media_usages: - print(f'media usage: {media_usage.id}', flush=True) - media_usage.deleted_utc = post.deleted_utc - g.db.add(media_usage) + if not media_usage.removed_utc: + print(f'media usage: {media_usage.id}', flush=True) + media_usage.removed_utc = time.time() + g.db.add(media_usage) for comment in post.comments: print(f'draft comment: {comment.id}', flush=True) - comment.deleted_utc = time.time() - g.db.add(comment) for media_usage in comment.media_usages: - print(f'media usage: {media_usage.id}', flush=True) - media_usage.deleted_utc = comment.deleted_utc - g.db.add(media_usage) + if not media_usage.removed_utc: + print(f'media usage: {media_usage.id}', flush=True) + media_usage.removed_utc = time.time() + g.db.add(media_usage)