fix: RSS feed now shows newest posts first

Fixed bug where feedgen library was reversing the order of feed items.
Database returns notes in DESC order (newest first), but feedgen was
displaying them oldest-first in the RSS XML. Added reversed() wrapper
to maintain correct chronological order in the feed.

Added regression test to verify feed order matches database order.

Bug confirmed by testing:
- Database: [Note 2, Note 1, Note 0] (newest first)
- Old feed: [Note 0, Note 1, Note 2] (oldest first) 
- New feed: [Note 2, Note 1, Note 0] (newest first) 

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-25 09:56:10 -07:00
parent 9e4aab486d
commit d9df55ae63
2 changed files with 44 additions and 2 deletions

View File

@@ -92,8 +92,9 @@ def generate_feed(
# Set last build date to now
fg.lastBuildDate(datetime.now(timezone.utc))
# Add items (limit to configured maximum)
for note in notes[:limit]:
# Add items (limit to configured maximum, newest first)
# Notes from database are DESC but feedgen reverses them, so we reverse back
for note in reversed(notes[:limit]):
# Create feed entry
fe = fg.add_entry()