Keep post.cross_posts at null instead of empty array if they don't have any

This commit is contained in:
freamon 2025-01-16 14:40:02 +00:00
parent d64dde5468
commit e85a0ddd9a

View file

@ -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()