fix event filtering

This commit is contained in:
2025-05-31 23:15:46 +02:00
parent 1c74706736
commit e1390a8adc
4 changed files with 106 additions and 4 deletions

View File

@@ -491,6 +491,24 @@ def init_routes(main_bp):
# Get paginated notifications
notifications = query.order_by(Notif.timestamp.desc()).paginate(page=page, per_page=per_page)
# Check if this is an AJAX request
if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
return jsonify({
'notifications': [{
'id': notif.id,
'notif_type': notif.notif_type,
'timestamp': notif.timestamp.strftime('%Y-%m-%d %H:%M:%S'),
'read': notif.read,
'details': notif.details,
'sender': {
'username': notif.sender.username,
'last_name': notif.sender.last_name
} if notif.sender else None
} for notif in notifications.items],
'total_pages': total_pages,
'current_page': page
})
return render_template('notifications/notifications.html',
notifications=notifications.items,
total_pages=total_pages,