From e85a0ddd9ae92079bced10c555e1ef553723190f Mon Sep 17 00:00:00 2001 From: freamon Date: Thu, 16 Jan 2025 14:40:02 +0000 Subject: [PATCH] Keep post.cross_posts at null instead of empty array if they don't have any --- app/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index d83cb360..5c14121a 100644 --- a/app/models.py +++ b/app/models.py @@ -1457,7 +1457,7 @@ class Post(db.Model): ncp.cross_posts.append(self.id) # this post: set the cross_posts field to the limited list of ids from the most recent other posts - if new_cross_posts: + if new_cross_posts.count() > 0: self.cross_posts = [ncp.id for ncp in new_cross_posts] db.session.commit()