Skip to content

Commit

Permalink
use getOmniChatSortQuery in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Dec 23, 2024
1 parent 6e540da commit add078c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/meteor/app/livechat/server/lib/QueueManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
} from '../../../lib/server/lib/notifyListener';
import { settings } from '../../../settings/server';
import { i18n } from '../../../utils/lib/i18n';
import { getOmniChatSortQuery } from '../../lib/inquiries';

const logger = new Logger('QueueManager');

Expand Down Expand Up @@ -336,7 +337,7 @@ export class QueueManager {
const [inq] = await LivechatInquiry.getCurrentSortedQueueAsync({
inquiryId: inquiry._id,
department: room.departmentId,
queueSortBy: getInquirySortMechanismSetting(),
queueSortBy: getOmniChatSortQuery(getInquirySortMechanismSetting()),
});

if (inq) {
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/server/services/omnichannel/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { License } from '@rocket.chat/license';
import { LivechatInquiry, LivechatRooms } from '@rocket.chat/models';

import { queueLogger } from './logger';
import { getOmniChatSortQuery } from '../../../app/livechat/lib/inquiries';
import { dispatchAgentDelegated } from '../../../app/livechat/server/lib/Helper';
import { RoutingManager } from '../../../app/livechat/server/lib/RoutingManager';
import { getInquirySortMechanismSetting } from '../../../app/livechat/server/lib/settings';
Expand Down Expand Up @@ -112,7 +113,7 @@ export class OmnichannelQueue implements IOmnichannelQueue {
private async checkQueue(queue: string | undefined) {
queueLogger.debug(`Processing items for queue ${queue || 'Public'}`);
try {
const nextInquiry = await LivechatInquiry.findNextAndLock(getInquirySortMechanismSetting(), queue);
const nextInquiry = await LivechatInquiry.findNextAndLock(getOmniChatSortQuery(getInquirySortMechanismSetting()), queue);
if (!nextInquiry) {
queueLogger.debug(`No more items for queue ${queue || 'Public'}`);
return;
Expand Down

0 comments on commit add078c

Please sign in to comment.