PILOS icon indicating copy to clipboard operation
PILOS copied to clipboard

Stop auto-reload if room guest access is denied

Open samuelwei opened this issue 1 month ago • 3 comments

  • Bugfix
  • Feature
  • Documentation
  • Refactoring (e.g. Style updates, Test implementation, etc.)
  • Other (please describe):

Checklist

  • [x] Code updated to current develop branch head
  • [x] Passes CI checks
  • [ ] Is a part of an issue
  • [ ] Tests added for the bugfix or newly implemented feature, describe below why if not
  • [x] Changelog is updated
  • [x] Documentation of code and features exists

Changes

  • Changed: Auto-reload of rooms now disabled for guests without access

Other information

The old behaviour didn't offer much of an advantage, as reloading probably won't make a difference. It would only have an effect if the room settings were changed. The major disadvantage of the old approach was the high number of failed requests, which spammed the logs and increased the error count metrics.

Summary by CodeRabbit

  • Changed

    • Auto-reload of rooms is disabled for guests who lack access.
  • Bug Fixes

    • Prevented multiple concurrent auto-refresh cycles; auto-refresh is paused on access errors and properly resumes after successful data updates.
  • Tests

    • Added end-to-end tests validating auto-reload behavior and that reload is disabled when guests are blocked.

samuelwei avatar Nov 07 '25 13:11 samuelwei

Walkthrough

Prevent duplicate auto-refresh timers in RoomsView, stop auto-reload when guests lack access, resume auto-reload after successful reloads, add changelog entry documenting disabled auto-reload for guests, and add two e2e tests covering auto-reload behavior and error handling.

Changes

Cohort / File(s) Change Summary
Documentation
CHANGELOG.md
Added Unreleased → Changed entry noting auto-reload is disabled for guests without access and added reference link for #2588.
Room Auto-Refresh Logic
resources/js/views/RoomsView.vue
Prevents creating duplicate intervals by checking reloadInterval.value before initializing; clears and nulls the interval on guests_not_allowed and on invalid token; removed immediate auto-restart on guests-not-allowed path; reinstates auto-refresh after successful reload.
End-to-end Tests
tests/Frontend/e2e/RoomsViewGeneral.cy.js
Added two tests: auto-reload (verifies periodic reload triggers) and auto-reload disabled on error (verifies no reload after guests_not_allowed 403). Both use clock/tick and intercepts to assert request counts and UI error state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check the null-check logic in startAutoRefresh and ensure no race conditions with interval clearing.
  • Verify handleGuestsNotAllowed and handleInvalidToken consistently clear and reset interval state.
  • Review reload re-enablement timing to ensure it only restarts after successful data load.
  • Run the new e2e tests locally to confirm flakeless behavior and correct intercept/time mocking.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: disabling auto-reload when guest access to rooms is denied, which directly aligns with the changeset.
Description check ✅ Passed The description follows the template with a clear type selection, completed checklist items, specific changes listed, and detailed rationale provided. All major sections are addressed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch disable-room-reload-on-guest-access-forbidden

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 07 '25 13:11 coderabbitai[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 96.24%. Comparing base (1e933f4) to head (947aff6).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2588      +/-   ##
=============================================
- Coverage      96.75%   96.24%   -0.51%     
  Complexity      1816     1816              
=============================================
  Files            434      257     -177     
  Lines          12483     6213    -6270     
  Branches        2078        0    -2078     
=============================================
- Hits           12078     5980    -6098     
+ Misses           405      233     -172     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 07 '25 14:11 codecov[bot]

PILOS    Run #2684

Run Properties:  status check passed Passed #2684  •  git commit a4efe7b8e1: Stop auto-reload if room guest access is denied
Project PILOS
Branch Review disable-room-reload-on-guest-access-forbidden
Run status status check passed Passed #2684
Run duration 07m 40s
Commit git commit a4efe7b8e1: Stop auto-reload if room guest access is denied
Committer Samuel Weirich
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 610
View all changes introduced in this branch ↗︎

cypress[bot] avatar Nov 07 '25 14:11 cypress[bot]