Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow users to force close Omnichannel rooms #34940

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

KevLehman
Copy link
Contributor

@KevLehman KevLehman commented Jan 13, 2025

Proposed changes (including videos or screenshots)

The new param passed to rooms.closeByUser endpoint allows users to forcefully close an omnichannel conversation.
This may come handy when a room, for X or Y reason ends up in a bad state, given an error during the closing procedure, or an update after the room has been closed. Currently, calling the API again will throw an error, as the room state is not valid and as such we avoid updating it.
This new setting will allow admins to allow the forceClose parameter, which will skip most of the validations and run the closing process again.

Issue(s)

https://rocketchat.atlassian.net/browse/CONN-475

Steps to test or reproduce

Further comments

Copy link
Contributor

dionisio-bot bot commented Jan 13, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Jan 13, 2025

🦋 Changeset detected

Latest commit: 33d54b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 37 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/i18n Minor
@rocket.chat/rest-typings Minor
@rocket.chat/mock-providers Patch
@rocket.chat/ui-contexts Major
@rocket.chat/web-ui-registration Major
@rocket.chat/api-client Patch
@rocket.chat/core-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/models Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/ui-client Major
@rocket.chat/ui-voip Major
@rocket.chat/uikit-playground Patch
@rocket.chat/gazzodown Major
@rocket.chat/livechat Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-video-conf Major
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/network-broker Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/core-typings Minor
@rocket.chat/apps Patch
@rocket.chat/freeswitch Patch
@rocket.chat/model-typings Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker 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

Copy link
Contributor

github-actions bot commented Jan 13, 2025

PR Preview Action v1.6.0

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-34940/

Built to branch gh-pages at 2025-01-16 03:48 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.12%. Comparing base (1f54b73) to head (33d54b7).
Report is 4 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #34940      +/-   ##
===========================================
- Coverage    59.12%   59.12%   -0.01%     
===========================================
  Files         2819     2819              
  Lines        67938    67935       -3     
  Branches     15134    15135       +1     
===========================================
- Hits         40171    40169       -2     
+ Misses       24934    24933       -1     
  Partials      2833     2833              
Flag Coverage Δ
unit 74.99% <100.00%> (+<0.01%) ⬆️

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

@KevLehman KevLehman added this to the 7.3.0 milestone Jan 13, 2025
@KevLehman KevLehman marked this pull request as ready for review January 14, 2025 17:51
@KevLehman KevLehman requested review from a team as code owners January 14, 2025 17:51
tapiarafael
tapiarafael previously approved these changes Jan 15, 2025
.changeset/eight-humans-sip.md Outdated Show resolved Hide resolved
@@ -240,10 +240,10 @@ class LivechatClass {
session: ClientSession,
): Promise<{ room: IOmnichannelRoom; closedBy: ChatCloser; removedInquiry: ILivechatInquiryRecord | null }> {
const { comment } = params;
const { room } = params;
const { room, forceClose } = params;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should re-check the setting here 🤔
I know you're already checking in the endpoint level, but maybe we should have something at a lower level to prevent force closing if the setting is disabled. This is more of an opinion, so I'd like to hear what you think or if you thought about this already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmmm, not sure.

I mean, there's no other place that we expose that can use this param right now so thought checking at the caller makes sense.

Wdyt?


await closeLivechatRoom(this.user, rid, { comment, tags, generateTranscriptPdf, transcriptEmail });
const allowForceClose = rcSettings.get<boolean>('Omnichannel_allow_force_close_conversations');
Copy link
Member

Choose a reason for hiding this comment

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

What if someone tries to force close a room in a workspace where this is not enabled? Shouldn't we throw an error? I wonder if just silently not force closing could be misleading

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will throw an error. It will be the normal room closing error as of the setting was ignored.

Didn't want to add a new error just for this case, as it could be confusing

Co-authored-by: Matheus Barbosa Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants