-
Notifications
You must be signed in to change notification settings - Fork 13.1k
[FIX] Livechat Agents & monitors not able to pick up chats from queue #24541
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ Meteor.methods({ | |
| fields: { _id: 1, username: 1, roles: 1, status: 1, statusLivechat: 1 }, | ||
| }); | ||
| if (!userCanTakeInquiry(user)) { | ||
| throw new Meteor.Error('error-not-allowed', 'Not allowed', { | ||
| throw new Meteor.Error('error-not-allowed-due-to-offline', `Not allowed since user's status is offline`, { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it true that the only reason for not being able to take the inquiry is because the user is offline? 👀 |
||
| method: 'livechat:takeInquiry', | ||
| }); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ import { Accounts } from 'meteor/accounts-base'; | |
| import { TAPi18n } from 'meteor/rocketchat:tap-i18n'; | ||
|
|
||
| import { roomTypes } from '../../utils'; | ||
| import { LivechatRooms } from '../../models'; | ||
| import { LivechatRooms, LivechatInquiry } from '../../models/server'; | ||
| import { callbacks } from '../../../lib/callbacks'; | ||
| import { settings } from '../../settings/server'; | ||
| import { LivechatAgentActivityMonitor } from './statistics/LivechatAgentActivityMonitor'; | ||
|
|
@@ -49,6 +49,23 @@ Meteor.startup(async () => { | |
| 'cant-join-room', | ||
| ); | ||
|
|
||
| callbacks.add( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do this callback needs to be inside a Meteor.startup? Can be on its own ts file and imported on this one? 👀 |
||
| 'beforeJoinRoom', | ||
| function (user, room) { | ||
| if (room.t === 'l' && !room.servedBy) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| const inquiry = LivechatInquiry.findOneByRoomId(room._id); | ||
| if (!inquiry) { | ||
| throw new Meteor.Error('error-invalid-inquiry', `Error: No inquiry found connected to room with id: ${room._id}`); | ||
| } | ||
| Meteor.runAsUser(user._id, () => Meteor.call('livechat:takeInquiry', inquiry._id)); | ||
| } | ||
|
|
||
| return user; | ||
| }, | ||
| callbacks.priority.HIGH, | ||
| 'auto-assign-managers-to-livechat-rooms-if-no-one-is-assigned-to-chat', | ||
| ); | ||
|
|
||
| const monitor = new LivechatAgentActivityMonitor(); | ||
|
|
||
| let TroubleshootDisableLivechatActivityMonitor; | ||
|
|
||
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 gotta say: this works. this won't solve other room-related issues when some room props are updated (like room's name/visibility) but will solve our use case so we should be fine for now.
I'll create a task to address the bigger one.