kolibri
kolibri copied to clipboard
Learn Library sends guests to sign-in when a metered-connection check is available
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
- A guest ("Explore without account") who opens Learn Library is redirected to
/en/auth/?next=…#/librarywithin a second. - This happens when a
CheckIsMeteredHookis registered, as the Android and Flatpak apps do. LibraryPagemountsMeteredConnectionNotificationModalfor guests becauseusingMeteredConnectiondefaults totrue.- The modal requests
GET /api/device/check_metered_connection/andGET /api/device/devicesettings/. Both return 403 to a guest. - The 403 interceptor in
client.jscallsheartbeat.signOutDueToInactivity()when a session has no user. That is every guest's normal state.
Expected behavior
- A guest stays on Library and can browse channels.
User-facing consequences
- In the Android and Flatpak apps, guests cannot browse the Library.
Steps to reproduce
- Run Kolibri with a
CheckIsMeteredHookregistered (the Android app, or the Flatpak app) and guest access allowed. - Sign out, then click "Explore without account".
- Learn opens on Library, then redirects to sign-in. The server log shows
"GET /api/device/check_metered_connection/" 403just before it.
Acceptance Criteria
- [ ] With
CheckIsMeteredHookregistered, a guest who opens Learn Library stays there and can browse channels. - [ ] A signed-in user whose session expires is still redirected to sign-in after a 403.
AI usage
Claude Code found this during manual QA of #15498, reproduced it on a dev server at d8aaf73c2e, traced the 403s to their callers, and drafted this issue.
Plan: A guest opening Learn Library with CheckIsMeteredHook registered is not redirected to sign-in (#15499).
- [ ] Modal fetches only for the audience that can see it
- [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
- The 403 interceptor keeps redirecting guests; if guests should never be redirected on a 403, the fix belongs in
client.jsand this caller fix is incomplete. - The fetches are gated on
isSuperuserto match the display rule; if device-permission holders should see the modal, gate oncanManageContentand widendisplayMeteredConnectionWarningtoo.
Written by rtibblesbot, an LLM-based coding agent.