Private
Public Access
Fix inline article expand and back-to-stream scope in production
Clicking an article title opened the detail page instead of expanding it inline, and "Back to stream" then reset to every feed. Cause: the title (and the new-articles banner) used inline onclick= handlers, which production's CSP (script-src 'self') blocks — dev sends no CSP, so it worked there. The title link just fell through to its href. Behavior moves to delegated listeners in static/js/stream.js (modified clicks still open in a new tab). A test now fails if any template gains an inline on*= handler. The stream also passes its filter/tag/feed scope through the article link so the detail page's back link returns to it. Verified in a dev server enforcing the same CSP: title click expands and collapses in place, URL unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
37e658c49a
commit
7afda7d0ba
6 files changed
+71
-11
No files matched your search
@@ -238,6 +238,7 @@ def stream(request):
|
||||
# regardless of how a feed backdates an entry's published date.
|
||||
"latest_article_id": queryset.aggregate(Max("id"))["id__max"] or 0,
|
||||
"new_check_qs": urlencode(scope_params),
|
||||
"scope_qs": urlencode(scope_params),
|
||||
}
|
||||
return render(request, "reader/stream.html", context)
|
||||
|
||||
@@ -311,7 +312,14 @@ def _load_article_and_mark_read(user, article_id):
|
||||
@login_required
|
||||
def article_detail(request, article_id):
|
||||
article = _load_article_and_mark_read(request.user, article_id)
|
||||
return render(request, "reader/article_detail.html", {"article": article})
|
||||
# The stream passes its filter/tag/feed scope through the link so
|
||||
# "Back to stream" returns to it instead of resetting to every feed.
|
||||
back_params = {k: request.GET[k] for k in ("filter", "tag", "feed") if request.GET.get(k)}
|
||||
return render(
|
||||
request,
|
||||
"reader/article_detail.html",
|
||||
{"article": article, "back_qs": urlencode(back_params)},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
|
||||
Reference in new issue
Block a user