Skip to content

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Aug 26, 2025

Proposed changes (including videos or screenshots)

Issue(s)

https://rocketchat.atlassian.net/browse/CTZ-312

Steps to test or reproduce

Caused by #36747

Further comments

Basically, we were filtering by the units only, which worked for monitors as they have units. However, this check wasn't working for agents as agents don't have units, only departments.

Now, the check properly filters units & departments, allowing monitors to see a bit more of info they have the rights to see, but that wasn't working because of this limit.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Aug 26, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Aug 26, 2025

⚠️ No Changeset found

Latest commit: 8f576eb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@KevLehman KevLehman added this to the 7.10.0 milestone Aug 26, 2025
@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-7.10.0@128b228). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##             release-7.10.0   #36801   +/-   ##
=================================================
  Coverage                  ?   66.01%           
=================================================
  Files                     ?     3287           
  Lines                     ?   110191           
  Branches                  ?    20853           
=================================================
  Hits                      ?    72744           
  Misses                    ?    34771           
  Partials                  ?     2676           
Flag Coverage Δ
e2e 57.15% <ø> (?)
unit 71.44% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@KevLehman KevLehman marked this pull request as ready for review August 27, 2025 17:16
Copilot AI review requested due to automatic review settings August 27, 2025 17:16
@KevLehman KevLehman requested review from a team as code owners August 27, 2025 17:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a regression where department and unit limits were not correctly applied to agents in livechat functionality. The issue was caused by filtering logic that only checked for units but didn't properly handle agents who have departments but no units.

  • Updated query filtering logic to check both unit ancestors and direct unit IDs, and include rooms without departments
  • Modified test expectations to reflect that monitors with no units can now see public rooms rather than empty results
  • Added comprehensive test coverage for the new behavior with agents and monitors

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/meteor/ee/app/livechat-enterprise/server/lib/restrictQuery.ts Core fix to query filtering logic to handle both units and departments properly
apps/meteor/ee/tests/unit/apps/livechat-enterprise/lib/restrictQuery.tests.ts New comprehensive unit test suite for the restrictQuery function
apps/meteor/tests/end-to-end/api/livechat/21-reports.ts Updated test expectations for monitors with no units to check for public rooms
apps/meteor/tests/end-to-end/api/livechat/00-rooms.ts Added extensive integration tests for unit/room restrictions for agents and monitors
apps/meteor/tests/e2e/omnichannel/omnichannel-monitor-role.spec.ts Updated E2E test expectations and added configuration settings
apps/meteor/tests/data/livechat/department.ts Exported OnlineAgent type for use in other test files

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Harmeet221 Harmeet221 added the stat: QA assured Means it has been tested and approved by a company insider label Aug 28, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Aug 28, 2025
@kodiakhq kodiakhq bot merged commit f751dd4 into release-7.10.0 Aug 28, 2025
87 of 89 checks passed
@kodiakhq kodiakhq bot deleted the regression/restrictquery branch August 28, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants