Skip to content

Improve room require code error handling#3035

Open
Sabr1n4W wants to merge 8 commits intodevelopfrom
improve-room-require-code-error-handling
Open

Improve room require code error handling#3035
Sabr1n4W wants to merge 8 commits intodevelopfrom
improve-room-require-code-error-handling

Conversation

@Sabr1n4W
Copy link
Copy Markdown
Contributor

@Sabr1n4W Sabr1n4W commented Apr 9, 2026

Fixes #

Type

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

Checklist

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

Changes

  • Improved require code handling by showing a more specific error message and not showing invalid code error message and error state in access code overlay

Other information

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling when a room requires an access code: UI now shows a "require access code" message, clears the access-code input on reload, and avoids re-triggering invalid-code detection during reloads.
  • Documentation

    • Changelog updated to document the improved access-code error handling.
  • Tests

    • Frontend tests updated to expect the new "require access code" behavior, input reset, and adjusted reload flows.

@Sabr1n4W Sabr1n4W self-assigned this Apr 9, 2026
@Sabr1n4W Sabr1n4W added the frontend Pull requests that update Javascript code label Apr 9, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

Warning

Rate limit exceeded

@Sabr1n4W has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 14 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 52 minutes and 14 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c8550ef5-e260-4442-a780-3f1792e9debf

📥 Commits

Reviewing files that changed from the base of the PR and between 42030bb and f8fc2b8.

📒 Files selected for processing (1)
  • resources/js/views/RoomsView.vue

Walkthrough

Adds a new requireCode emit across room-related Vue components, changes handling of 403 + HTTP_ROOM_REQUIRE_CODE to emit requireCode, updates RoomsView to clear/reset access-code state and show rooms.require_access_code, replaces some reload/login flows, and updates E2E tests to assert the new behavior.

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
Added Unreleased "Changed" entry documenting improved handling when a room requires an access code and added link reference for #3035.
Room access components
resources/js/components/RoomJoinButton.vue, resources/js/components/RoomTabFiles.vue, resources/js/components/RoomTabRecordings.vue
Added requireCode to defineEmits and changed handlers to emit requireCode instead of invalidRoomAuthToken for HTTP 403 + HTTP_ROOM_REQUIRE_CODE cases.
Tab wrapper / passthrough
resources/js/components/RoomTabSection.vue
Added requireCode to defineEmits, propagated child requireCode events upward via @require-code="$emit('requireCode')" and $emit('requireCode') passthroughs.
Room header membership
resources/js/components/RoomHeader.vue
Changed RoomMembershipButton left-membership handler to emit leftMembership and added leftMembership to defineEmits (removed reload emission for this event).
Main room view logic
resources/js/views/RoomsView.vue
Wired @require-code handlers on RoomJoinButton/RoomTabSection; added handleRequireCode() to reset access-code UI/errors and show rooms.require_access_code; changed reload() signature to reload(checkForRequireCodeError = true) and adjusted reload paths to conditionally invoke handleRequireCode().
E2E tests
tests/Frontend/e2e/RoomsView*.cy.js (multiple specs)
Replaced click flows to use [data-test="reload-room-button"], removed some @roomAuthRequest waits, updated intercept assertions to expect room_auth_token/room_auth_token_type undefined, changed toast checks from rooms.flash.access_code_invalid to rooms.require_access_code, and asserted access-code input is cleared.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

refactor, tests

Suggested reviewers

  • samuelwei
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. While the author filled in the Type and some Checklist items, the critical 'Fixes #' field is blank, the PR objectives are unclear, and the Changes section lacks detail about the scope and technical approach of the refactoring. Fill in the issue number in 'Fixes #' field, provide more detailed bullet points under Changes explaining the component updates and event flow modifications, and clarify whether CI checks actually pass.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: improving error handling for room require code scenarios across multiple frontend components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-room-require-code-error-handling

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.99%. Comparing base (3c8a92f) to head (f8fc2b8).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3035      +/-   ##
=============================================
- Coverage      96.73%   92.99%   -3.75%     
  Complexity      1924     1924              
=============================================
  Files            457      457              
  Lines          12988    13003      +15     
  Branches        2079     2089      +10     
=============================================
- Hits           12564    12092     -472     
- Misses           424      911     +487     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@cypress
Copy link
Copy Markdown

cypress bot commented Apr 9, 2026

PILOS    Run #2947

Run Properties:  status check failed Failed #2947  •  git commit f8fc2b860e: Improve room require code error handling
Project PILOS
Branch Review improve-room-require-code-error-handling
Run status status check failed Failed #2947
Run duration 07m 38s
Commit git commit f8fc2b860e: Improve room require code error handling
Committer Sabrina Wüst
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
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 621
View all changes introduced in this branch ↗︎

Tests for review

Failed  tests/Frontend/e2e/RoomsViewGeneral.cy.js • 1 failed test • Frontend tests

View Output

Test Artifacts
Room View general > membership button Test Replay Screenshots

@Sabr1n4W Sabr1n4W marked this pull request as ready for review April 10, 2026 07:09
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@resources/js/views/RoomsView.vue`:
- Around line 407-420: The handler handleRequireCode resets the UI but leaves
the stale roomAuthToken in place so the subsequent reload() call will still send
the old token; clear or set roomAuthToken to null/empty (or call the function
that resets it) before calling reload(false) so the follow-up GET doesn't
include the stale token and the server sees the updated "code required" state;
update handleRequireCode to reset the roomAuthToken variable (or invoke the
existing resetAuthToken helper) immediately prior to reload().
- Around line 528-535: The check is reading room.value?.authenticated after an
async reload which lets concurrent reloads both see the same old state and call
handleRequireCode(false) twice; capture the prior auth state into a local
variable before awaiting the reload (e.g., const prevAuthenticated =
room.value?.authenticated) and use that local (prevAuthenticated) in the
condition that uses checkForRequireCodeError and
response.data.data.authenticated, so handleRequireCode(false) only runs when the
single captured previous state indicates authenticated and the new response says
unauthenticated.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3ae73c31-b2e9-4a64-bacd-ead00b82c067

📥 Commits

Reviewing files that changed from the base of the PR and between 3688a9f and eb78d8e.

📒 Files selected for processing (1)
  • resources/js/views/RoomsView.vue

Comment thread resources/js/views/RoomsView.vue Outdated
Comment thread resources/js/views/RoomsView.vue
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
resources/js/views/RoomsView.vue (2)

530-537: ⚠️ Potential issue | 🟡 Minor

Use the pre-refresh auth state only once to avoid race conditions.

The transition check reads room.value?.authenticated before room.value is updated. If two reload() calls resolve back-to-back, both handlers can still see the old authenticated state and potentially fire handleRequireCode() twice.

Proposed fix
     .then((response) => {
-      // Room was authenticated but now requires an access code
-      if (
-        checkForRequireCodeError &&
-        room.value?.authenticated &&
-        !response.data.data.authenticated
-      ) {
-        handleRequireCode();
-      }
-
-      room.value = response.data.data;
+      const wasAuthenticated = room.value?.authenticated;
+      room.value = response.data.data;
+
+      // Room was authenticated but now requires an access code
+      if (
+        checkForRequireCodeError &&
+        wasAuthenticated &&
+        !room.value.authenticated
+      ) {
+        handleRequireCode();
+      }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@resources/js/views/RoomsView.vue` around lines 530 - 537, Store the
pre-refresh authenticated state in a local variable and use that single snapshot
in the conditional instead of reading room.value again to avoid race conditions;
i.e., before triggering the code path that may cause reloads (where
checkForRequireCodeError is used), capture const wasAuthenticated =
room.value?.authenticated and then use wasAuthenticated in the if-check with
checkForRequireCodeError and response.data.data.authenticated to decide whether
to call handleRequireCode(), ensuring reload() or back-to-back responses cannot
both see the old room.value and call handleRequireCode() twice.

410-423: ⚠️ Potential issue | 🟠 Major

Clear the stale room auth token before reloading.

This handler resets the overlay state, but reload() will still send the old roomAuthToken on the next GET request. This keeps the follow-up request out of sync with the "code required again" state.

Proposed fix
 function handleRequireCode() {
+  roomAuthToken.value = null;
+
   // Reset access code error states to prevent confusing error state
   accessCodeInvalid.value = null;
   formErrors.clear();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@resources/js/views/RoomsView.vue` around lines 410 - 423, handleRequireCode
resets UI state but doesn't clear the stale room auth token, so subsequent
reload() calls will still include the old token; update handleRequireCode to
also clear the room auth token (e.g. set roomAuthToken.value = null or call the
existing clearRoomAuthToken helper if present) before returning so the next GET
reflects the "code required" state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@resources/js/views/RoomsView.vue`:
- Around line 232-235: The call to reload() inside RoomTabSection should match
RoomJoinButton's reload(false) to avoid duplicate require-code toasts: update
the `@require-code` handler (the invocation that currently calls
handleRequireCode(); reload();) to call reload(false) instead of reload(), so
handleRequireCode() won't be invoked again via the reload success handler when
checkForRequireCodeError is true; reference RoomTabSection, RoomJoinButton,
reload(), handleRequireCode(), and checkForRequireCodeError when making the
change.

---

Duplicate comments:
In `@resources/js/views/RoomsView.vue`:
- Around line 530-537: Store the pre-refresh authenticated state in a local
variable and use that single snapshot in the conditional instead of reading
room.value again to avoid race conditions; i.e., before triggering the code path
that may cause reloads (where checkForRequireCodeError is used), capture const
wasAuthenticated = room.value?.authenticated and then use wasAuthenticated in
the if-check with checkForRequireCodeError and response.data.data.authenticated
to decide whether to call handleRequireCode(), ensuring reload() or back-to-back
responses cannot both see the old room.value and call handleRequireCode() twice.
- Around line 410-423: handleRequireCode resets UI state but doesn't clear the
stale room auth token, so subsequent reload() calls will still include the old
token; update handleRequireCode to also clear the room auth token (e.g. set
roomAuthToken.value = null or call the existing clearRoomAuthToken helper if
present) before returning so the next GET reflects the "code required" state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cd1232b3-1be1-486f-8c0f-010284ca307f

📥 Commits

Reviewing files that changed from the base of the PR and between eb78d8e and 42030bb.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • resources/js/components/RoomHeader.vue
  • resources/js/views/RoomsView.vue
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Comment thread resources/js/views/RoomsView.vue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Pull requests that update Javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant