i18n+filtering fork - fluent-templates v2
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Smokesignal Changelog#

Major Bug Fixes & Feature Improvements (2025-06-04)#

This release addresses multiple critical issues that were preventing the smokesignal application from working correctly. The application was previously showing "it doesn't work" behavior due to several interconnected problems.

🐛 Primary Bug Fix: Homepage showing too many events (120 instead of 12)#

Problem: The homepage was displaying 120 events instead of the expected 12 events (2 upcoming + 10 recent). This was caused by a template loop bug where the event_list.*.incl.html template had its own loop that was being called from within another loop in the main template.

Root Cause:

  • Homepage template looped through upcoming_events (2 events) and included event_list.*.incl.html for each
  • Homepage template looped through events (10 recent events) and included event_list.*.incl.html for each
  • The included event_list.*.incl.html template had its own {% for event in events %} loop that rendered all 10 recent events
  • Result: 2 × 10 + 10 × 10 = 120 events displayed

Solution: Created separate single-event templates for homepage use while preserving the original templates for the events filter page.

🔧 Secondary Bug Fix: Pagination System Not Working Properly#

Problem: The homepage pagination logic was inconsistent - extracting page_size from pagination but then hard-coding database calls to use 10.

Solution:

  • Implemented proper page_size + 1 pattern for pagination detection
  • Fixed database queries to use extracted page_size consistently
  • Added proper truncation logic with debug logging

🌐 Bug Fix: Timezone Detection Middleware Failing#

Problem: User timezone detection wasn't working, causing date/time display issues.

Solution:

  • Enhanced timezone middleware to detect user IP via X-Forwarded-For headers
  • Integrated worldtimeapi.org for accurate timezone detection
  • Added proper error handling and fallback mechanisms

🌍 Bug Fix: Internationalization (i18n) System Issues#

Problem: Language detection and switching between French Canadian (fr-CA) and English (en-US) wasn't working correctly.

Solution:

  • Improved i18n middleware with proper Accept-Language header parsing
  • Enhanced language negotiation with fallback chains
  • Added missing translation strings in both languages

🔍 Bug Fix: Event Filtering System Incomplete#

Problem: The /events filter page wasn't working - missing search, date filtering, and location filtering.

Solution:

  • Implemented comprehensive filtering system with facets
  • Added text search, date range filtering, and location-based filtering
  • Enhanced query builder with proper SQL generation
  • Added geolocation support with radius-based filtering

📊 Bug Fix: Database Query Performance & Data Hydration#

Problem: Missing RSVP counts, organizer information, and inefficient database queries.

Solution:

  • Implemented proper event hydration system
  • Added RSVP count aggregation
  • Enhanced organizer handle resolution
  • Optimized database queries with proper joins

🎨 Bug Fix: Template Rendering Issues#

Problem: Templates not rendering correctly with proper data binding and includes.

Solution:

📁 Files Changed#

✅ New Files Added:#

  • templates/single_event.en-us.incl.html - Single event template for homepage (English)
  • templates/single_event.fr-ca.incl.html - Single event template for homepage (French)
  • i18n/en-us/filters.ftl - Filter-related translations (English)
  • i18n/fr-ca/filters.ftl - Filter-related translations (French)
  • src/bin/debug_next_week.rs - Debug utility for week calculations
  • src/bin/test_date_ranges.rs - Debug utility for date range testing
  • log.txt - Application logs

🔧 Modified Files:#

Core Logic:

  • src/http/handle_index.rs - Fixed pagination logic, removed unused imports and variables
  • src/http/handle_filter_events.rs - Enhanced filtering functionality
  • src/http/middleware_filter.rs - Improved filter middleware
  • src/filtering/query_builder.rs - Enhanced query building capabilities
  • src/filtering/facets.rs - Improved facet handling
  • src/filtering/hydration.rs - Enhanced event hydration

Templates:

  • templates/index.en-us.common.html - Updated to use single_event.*.incl.html
  • templates/index.fr-ca.common.html - Updated to use single_event.*.incl.html
  • templates/event_list.en-us.incl.html - Restored original loop structure for filter page
  • templates/event_list.fr-ca.incl.html - Restored original loop structure for filter page
  • templates/filter_events.common.html - Enhanced filtering interface
  • templates/filter_events_results.incl.html - Improved results display

Internationalization:

  • i18n/en-us/common.ftl - Updated common translations
  • i18n/en-us/forms.ftl - Enhanced form translations
  • i18n/en-us/ui.ftl - Cleaned up UI translations
  • i18n/fr-ca/common.ftl - Updated common translations
  • i18n/fr-ca/forms.ftl - Enhanced form translations
  • i18n/fr-ca/ui.ftl - Cleaned up UI translations

Infrastructure:

  • src/bin/smokesignal.rs - Minor configuration updates
  • src/http/middleware_i18n.rs - Improved language handling
  • src/http/middleware_timezone.rs - Enhanced timezone processing
  • Various other middleware and utility files

🗑️ Deleted Files:#

  • templates/archive/filter_events.en-us.common.html - Archived old filter template
  • templates/archive/filter_events.fr-ca.common.html - Archived old filter template
  • templates/archive/filter_events_results.en-us.incl.html - Archived old results template
  • templates/archive/filter_events_results.fr-ca.incl.html - Archived old results template

🔧 Technical Details#

Before Fix:

Homepage Template Loop:
├── upcoming_events (2 items)
│   └── each calls event_list.*.incl.html
│       └── loops through all events (10 items) = 20 events
└── events (10 items) 
    └── each calls event_list.*.incl.html
        └── loops through all events (10 items) = 100 events
Total: 120 events displayed

After Fix:

Homepage Template Loop:
├── upcoming_events (2 items)
│   └── each calls single_event.*.incl.html
│       └── renders 1 event = 2 events
└── events (10 items)
    └── each calls single_event.*.incl.html  
        └── renders 1 event = 10 events
Total: 12 events displayed ✅

Filter Page (unchanged):

Filter Results Template:
└── calls event_list.*.incl.html
    └── loops through filtered events
        └── renders all results correctly ✅

✅ Result#

  • ✅ Homepage now correctly displays 12 events maximum (2 upcoming + 10 recent)
  • ✅ Filter page continues to work correctly with all events
  • ✅ Pagination system working as intended
  • ✅ All compiler warnings cleaned up
  • ✅ Both English and French templates working
  • ✅ No breaking changes to existing functionality

🧪 Verification#

  • Backend logs confirm: upcoming_events.len()=2, recent_events.len()=11 (11 fetched, 10 displayed)
  • Frontend displays exactly 12 events total
  • Event filter page (/events) continues to display full event lists correctly
  • All HTMX functionality preserved