🐛 Only pick featured posts in posts which visibility is all

This commit is contained in:
LittleSheep 2024-12-10 21:12:35 +08:00
parent 45d5ea5a68
commit 851c8e2f70

View File

@ -31,8 +31,9 @@ func GetFeaturedPosts(count int) ([]models.Post, error) {
ORDER BY social_points DESC ORDER BY social_points DESC
LIMIT ? LIMIT ?
) t ON p.id = t.post_id ) t ON p.id = t.post_id
WHERE p.visibility = ?
ORDER BY t.social_points DESC, p.published_at DESC ORDER BY t.social_points DESC, p.published_at DESC
`, deadline, count).Scan(&posts).Error; err != nil { `, deadline, count, models.PostVisibilityAll).Scan(&posts).Error; err != nil {
return posts, err return posts, err
} }