Move notifications page to fully client-side API rendering#6235
Merged
Move notifications page to fully client-side API rendering#6235
Conversation
The notifications page previously used a hybrid approach: server-rendered initial notifications via Twig templates, with JS handling only tab switching and infinite scroll. This migrates to a fully API-driven approach where all notification data is fetched via GET /api/notifications. - Simplify NotificationController to only check auth and render empty shell - Remove server-rendered notification loop from Twig template - Delete 8 per-type Twig templates (Base, Like, Comment, Follow, etc.) - Update JS to fetch initial "All" tab data via API on page load - Add event delegation for click handling on dynamically rendered items - Add per-tab cursor tracking for proper pagination state - Update Behat tests to wait for AJAX after navigating to notifications page - Update CLAUDE.md with Docker build/cache and DOMContentLoaded learnings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addresses code review findings: - Add escapeHtml() for all user-controlled data in template literals (XSS fix) - Replace 5 boolean tab flags with single activeTab string + TAB_CONFIG array - Data-driven tab click handlers and scroll handler (eliminates copy-paste) - Per-type fetchActive lock instead of global boolean (fixes cross-tab blocking) - Add requestAnimationFrame throttle to scroll handler - Use ApiFetch.run() instead of raw generateAuthenticatedFetch() (proper error handling) - Simplify updateNoNotificationsPlaceholder with string interpolation - Add early return in redirectUser after first branch - Cache container DOM references in constructor - Merge resetChips/resetColor into single data-driven loop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6235 +/- ##
=============================================
+ Coverage 51.97% 52.07% +0.10%
+ Complexity 8204 8191 -13
=============================================
Files 739 739
Lines 26319 26264 -55
=============================================
Hits 13678 13678
+ Misses 12641 12586 -55
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /api/notificationsNotificationControllerto a thin auth-checking shell that renders an empty templatetemplates/User/Notification/Type/)Test plan
🤖 Generated with Claude Code