kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Learn Library sends guests to sign-in when a metered-connection check is available

Open rtibblesbot opened this issue 1 month ago • 1 comments

❌ 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=…#/library within a second.
  • This happens when a CheckIsMeteredHook is registered, as the Android and Flatpak apps do.
  • LibraryPage mounts MeteredConnectionNotificationModal for guests because usingMeteredConnection defaults to true.
  • The modal requests GET /api/device/check_metered_connection/ and GET /api/device/devicesettings/. Both return 403 to a guest.
  • The 403 interceptor in client.js calls heartbeat.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

  1. Run Kolibri with a CheckIsMeteredHook registered (the Android app, or the Flatpak app) and guest access allowed.
  2. Sign out, then click "Explore without account".
  3. Learn opens on Library, then redirects to sign-in. The server log shows "GET /api/device/check_metered_connection/" 403 just before it.

Acceptance Criteria

  • [ ] With CheckIsMeteredHook registered, 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.

rtibblesbot avatar Oct 04 '26 19:10 rtibblesbot

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.js and this caller fix is incomplete.
  • The fetches are gated on isSuperuser to match the display rule; if device-permission holders should see the modal, gate on canManageContent and widen displayMeteredConnectionWarning too.

Written by rtibblesbot, an LLM-based coding agent.

rtibblesbot avatar Oct 16 '26 03:10 rtibblesbot