-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
[FIX] Send Livechat back to Guest Pool #10731
Conversation
@@ -307,7 +307,7 @@ RocketChat.Livechat = { | |||
|
|||
forwardOpenChats(userId) { | |||
RocketChat.models.Rooms.findOpenByAgent(userId).forEach((room) => { | |||
const guest = RocketChat.models.Users.findOneById(room.v._id); | |||
const guest = LivechatVisitors.findOneById(room.v._id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh... this is an important fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not closes #9278 .. the change requested was to add an option to the following setting:
also, why transfering a chat should send it back to the pool? there is a button specially for this..
@sampaiodiego, I will explain to you why I thought that fixing this issue it would fixes the #9278 too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also find an issue with the new URL scheme for livechats.. when I accept the inquiry I'm being redirect to an invalid URL (without the room _id
): http://localhost:3000/live
//In this case, an error is raised, so to avoid this the room user is instantiated | ||
let user = Meteor.user(); | ||
if (!user) { | ||
user = RocketChat.models.Users.findOne(room.servedBy._id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you cannot get the room agent at this point because on lines bellow you're validating if the user has permission..
on the validation bellow you must validate against the logged in user who is performing the action.
} | ||
|
||
// //delete agent and room subscription | ||
if (!user._id || !RocketChat.authz.hasPermission(user._id, 'view-l-room')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the user
is null
or undefined
this will throw an error.
RocketChat.models.Subscriptions.removeByRoomId(rid); | ||
|
||
// remove user from room | ||
const username = Meteor.user().username; | ||
const username = user.username; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this must be the agent and not the logged in user.. imagine a situation where the manager is returning the livechat to the queue.
…ocketChat/Rocket.Chat into livechat-return-chat-to-the-guest-pool
@sampaiodiego, all requested changes are made. |
can you please fix the conflicts? thx |
# Conflicts: # packages/rocketchat-livechat/server/methods/returnAsInquiry.js # packages/rocketchat-livechat/server/methods/takeInquiry.js
@sampaiodiego, |
Closes #7397
Closes #9278
Closes #11347
This PR fixes the
forward chat
in Livechat rooms when using theGuest Pool
routing method. Until then, when a chat was redirected to a department, for example, it was being assigned to an agent randomly instead of returning to the pool.In addition, it also fixes the #9278, having the same behaviour when an agent goes offline and the
Livechat_agent_leave_action
setting is set toforward
.