fix: Agents can't leave omnichannel rooms that have already been closed
Proposed changes (including videos or screenshots)
- Allow users to leave omnichannel rooms after they have been closed (by the visitor). If a user tries to close a room that has already been closed AND they have a subscription in this room, we'll remove them from the room instead of throwing an error.
Due to some race condition, users could end up joining omnichannel rooms that have already been closed, which caused them to get stuck in there.
Issue(s)
Steps to test or reproduce
Since having a user stuck in an omnichannel room after it's been closed depends on a race condition, reproducing this issue may require manually inserting a subscription in the DB.
With a user that is stuck in an omnichannel/livechat room, try to close the room again through the UI or using the livechat.closeRoomByUser endpoint OR the livechat:closeRoom method. Both options currently throw an error in this case, but with this PR, the subscription is removed and a succesful result should be returned.
Further comments
I decided not to add this change to the livechat.closeRoom endpoint since this one is meant to be used by visitors -- which are not subscribed to the room directly, only agents are.
🦋 Changeset detected
Latest commit: 10f01a1de27287906f3b87e86c159cf2901e31d7
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 32 packages
| Name | Type |
|---|---|
| @rocket.chat/meteor | Patch |
| @rocket.chat/core-typings | Patch |
| @rocket.chat/rest-typings | Patch |
| @rocket.chat/apps | Patch |
| @rocket.chat/core-services | Patch |
| @rocket.chat/cron | Patch |
| @rocket.chat/fuselage-ui-kit | Patch |
| @rocket.chat/gazzodown | Patch |
| @rocket.chat/livechat | Patch |
| @rocket.chat/model-typings | Patch |
| @rocket.chat/ui-contexts | Patch |
| @rocket.chat/account-service | Patch |
| @rocket.chat/authorization-service | Patch |
| @rocket.chat/ddp-streamer | Patch |
| @rocket.chat/omnichannel-transcript | Patch |
| @rocket.chat/presence-service | Patch |
| @rocket.chat/queue-worker | Patch |
| @rocket.chat/stream-hub-service | Patch |
| @rocket.chat/api-client | Patch |
| @rocket.chat/license | Patch |
| @rocket.chat/omnichannel-services | Patch |
| @rocket.chat/pdf-worker | Patch |
| @rocket.chat/presence | Patch |
| rocketchat-services | Patch |
| @rocket.chat/ddp-client | Patch |
| @rocket.chat/uikit-playground | Patch |
| @rocket.chat/models | Patch |
| @rocket.chat/ui-avatar | Patch |
| @rocket.chat/ui-client | Patch |
| @rocket.chat/ui-video-conf | Patch |
| @rocket.chat/web-ui-registration | Patch |
| @rocket.chat/instance-status | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Looks like this PR is ready to merge! 🎉 If you have any trouble, please check the PR guidelines
Fix?
Yep, should be fix.
Also, pls add a description of what this fixes (+ changeset). It should be clear which case of rooms getting stuck this fix clears 🤗
Codecov Report
Attention: Patch coverage is 83.33333% with 4 lines in your changes missing coverage. Please review.
Project coverage is 55.53%. Comparing base (
8fc6ca8) to head (10f01a1).
Additional details and impacted files
@@ Coverage Diff @@
## develop #32707 +/- ##
===========================================
+ Coverage 54.38% 55.53% +1.14%
===========================================
Files 2552 2633 +81
Lines 55985 57197 +1212
Branches 11614 11848 +234
===========================================
+ Hits 30450 31762 +1312
+ Misses 22933 22745 -188
- Partials 2602 2690 +88
| Flag | Coverage Δ | |
|---|---|---|
| e2e | 54.28% <50.00%> (+2.28%) |
:arrow_up: |
| unit | 72.11% <86.36%> (-0.03%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
/patch
/backport 6.9.3
/patch
Sorry, I couldn't do that backport because of conflicts. Could you please solve them?
you can do so by running the following commands:
git fetch
git checkout backport-6.10.1-32707
git cherry-pick fa82159492bb1589372ba4f7dcca716da7a8a74b
// solve the conflict
git push
after that just run /patch again
/backport 6.9.4
Sorry, I couldn't do that backport because of conflicts. Could you please solve them?
you can do so by running the following commands:
git fetch
git checkout backport-6.9.4-32707
git cherry-pick fa82159492bb1589372ba4f7dcca716da7a8a74b
// solve the conflict
git push
after that just run /backport 6.9.4 again
/patch
Pull request #32819 added to Project: "Patch 6.10.1"
/backport 6.9.4
Pull request #32822 added to Project: "Patch 6.9.4"