Skip to content

Commit

Permalink
Merge pull request RocketChat#23045 from RocketChat/release-3.17.2
Browse files Browse the repository at this point in the history
Release 3.17.2
  • Loading branch information
sampaiodiego authored Aug 26, 2021
2 parents 7ab533e + e0ec5e4 commit fe0e5e4
Show file tree
Hide file tree
Showing 17 changed files with 221 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi8/nodejs-12

ENV RC_VERSION 3.17.1
ENV RC_VERSION 3.17.2

MAINTAINER buildmaster@rocket.chat

Expand Down
60 changes: 60 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -63662,6 +63662,18 @@
"4.2"
],
"pull_requests": [
{
"pr": "22942",
"title": "Release 3.17.1",
"userLogin": "sampaiodiego",
"contributors": [
"KevLehman",
"sampaiodiego",
"thassiov",
"murtaza98",
"matheusbsilva137"
]
},
{
"pr": "22871",
"title": "[FIX] \"Click to Join\" button is not working if there are no muted users in the room",
Expand Down Expand Up @@ -63721,6 +63733,54 @@
]
}
]
},
"3.17.2": {
"node_version": "12.22.1",
"npm_version": "6.14.1",
"apps_engine_version": "1.27.1",
"mongo_versions": [
"3.4",
"3.6",
"4.0",
"4.2"
],
"pull_requests": [
{
"pr": "22976",
"title": "[FIX] Error getting default agent when routing system algorithm is Auto Selection",
"userLogin": "renatobecker",
"milestone": "3.17.2",
"contributors": [
"renatobecker",
"KevLehman",
"web-flow"
]
},
{
"pr": "22991",
"title": "[FIX] Fix Auto Selection algorithm on community edition",
"userLogin": "KevLehman",
"description": "- When using the autoselection algo on community editions, all agents were marked as unavailable due to an unapplied filter\r\n- Fixed an issue when both user & system setting to manange EE max number of chats allowed were set to 0",
"milestone": "3.17.2",
"contributors": [
"KevLehman",
"web-flow",
"renatobecker"
]
},
{
"pr": "22839",
"title": "[FIX] applyChatRestictions callback not working for community version",
"userLogin": "murtaza98",
"description": "Building on top of https://github.com/RocketChat/Rocket.Chat/pull/22838",
"milestone": "3.17.2",
"contributors": [
"Shailesh351",
"murtaza98",
"web-flow"
]
}
]
}
}
}
2 changes: 1 addition & 1 deletion .snapcraft/resources/prepareRocketChat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

curl -SLf "https://releases.rocket.chat/3.17.1/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/3.17.2/download/" -o rocket.chat.tgz

tar xf rocket.chat.tgz --strip 1

Expand Down
2 changes: 1 addition & 1 deletion .snapcraft/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 5. `snapcraft snap`

name: rocketchat-server
version: 3.17.1
version: 3.17.2
summary: Rocket.Chat server
description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/
confinement: strict
Expand Down
44 changes: 43 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@

# 3.17.2
`2021-08-26 · 3 🐛 · 4 👩‍💻👨‍💻`

### Engine versions
- Node: `12.22.1`
- NPM: `6.14.1`
- MongoDB: `3.4, 3.6, 4.0, 4.2`
- Apps-Engine: `1.27.1`

### 🐛 Bug fixes


- applyChatRestictions callback not working for community version ([#22839](https://github.com/RocketChat/Rocket.Chat/pull/22839) by [@Shailesh351](https://github.com/Shailesh351))

Building on top of https://github.com/RocketChat/Rocket.Chat/pull/22838

- Error getting default agent when routing system algorithm is Auto Selection ([#22976](https://github.com/RocketChat/Rocket.Chat/pull/22976))

- Fix Auto Selection algorithm on community edition ([#22991](https://github.com/RocketChat/Rocket.Chat/pull/22991))

- When using the autoselection algo on community editions, all agents were marked as unavailable due to an unapplied filter
- Fixed an issue when both user & system setting to manange EE max number of chats allowed were set to 0

### 👩‍💻👨‍💻 Contributors 😍

- [@Shailesh351](https://github.com/Shailesh351)

### 👩‍💻👨‍💻 Core Team 🤓

- [@KevLehman](https://github.com/KevLehman)
- [@murtaza98](https://github.com/murtaza98)
- [@renatobecker](https://github.com/renatobecker)

# 3.17.1
`2021-08-16 · 5 🐛 · 7 👩‍💻👨‍💻`
`2021-08-16 · 5 🐛 · 1 🔍 · 8 👩‍💻👨‍💻`

### Engine versions
- Node: `12.22.1`
Expand All @@ -26,13 +59,22 @@

- Use correct param on saveBusinessHour method ([#22835](https://github.com/RocketChat/Rocket.Chat/pull/22835))

<details>
<summary>🔍 Minor changes</summary>


- Release 3.17.1 ([#22942](https://github.com/RocketChat/Rocket.Chat/pull/22942))

</details>

### 👩‍💻👨‍💻 Core Team 🤓

- [@KevLehman](https://github.com/KevLehman)
- [@d-gubert](https://github.com/d-gubert)
- [@matheusbsilva137](https://github.com/matheusbsilva137)
- [@murtaza98](https://github.com/murtaza98)
- [@renatobecker](https://github.com/renatobecker)
- [@sampaiodiego](https://github.com/sampaiodiego)
- [@tassoevan](https://github.com/tassoevan)
- [@thassiov](https://github.com/thassiov)

Expand Down
4 changes: 1 addition & 3 deletions app/livechat/server/hooks/beforeDelegateAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { callbacks } from '../../../callbacks';
import { settings } from '../../../settings';
import { Users, LivechatDepartmentAgents } from '../../../models';

callbacks.add('livechat.beforeDelegateAgent', (options = {}) => {
const { department, agent } = options;

callbacks.add('livechat.beforeDelegateAgent', (agent, { department }) => {
if (agent) {
return agent;
}
Expand Down
5 changes: 5 additions & 0 deletions app/livechat/server/lib/Livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ export const Livechat = {
room = null;
}

if (guest.department && !LivechatDepartment.findOneById(guest.department)) {
LivechatVisitors.removeDepartmentById(guest._id);
guest = LivechatVisitors.findOneById(guest._id);
}

if (room == null) {
const defaultAgent = callbacks.run('livechat.checkDefaultAgentOnNewRoom', agent, guest);
// if no department selected verify if there is at least one active and pick the first
Expand Down
3 changes: 2 additions & 1 deletion app/livechat/server/lib/RoutingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ export const RoutingManager = {
},

delegateAgent(agent, inquiry) {
const defaultAgent = callbacks.run('livechat.beforeDelegateAgent', { agent, department: inquiry?.department });
const defaultAgent = callbacks.run('livechat.beforeDelegateAgent', agent, { department: inquiry?.department });

if (defaultAgent) {
LivechatInquiry.setDefaultAgentById(inquiry._id, defaultAgent);
}
Expand Down
2 changes: 1 addition & 1 deletion app/livechat/server/lib/routing/AutoSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AutoSelection {
}

getNextAgent(department, ignoreAgentId) {
const extraQuery = callbacks.run('livechat.applySimultaneousChatRestrictions', { ...department ? { departmentId: department } : {} });
const extraQuery = callbacks.run('livechat.applySimultaneousChatRestrictions', undefined, { ...department ? { departmentId: department } : {} });
if (department) {
return LivechatDepartmentAgents.getNextAgentForDepartment(department, ignoreAgentId, extraQuery);
}
Expand Down
4 changes: 4 additions & 0 deletions app/models/server/models/LivechatVisitors.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ export class LivechatVisitors extends Base {
}

// REMOVE
removeDepartmentById(_id) {
return this.update({ _id }, { $unset: { department: 1 } });
}

removeById(_id) {
const query = { _id };
return this.remove(query);
Expand Down
72 changes: 2 additions & 70 deletions app/models/server/models/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,76 +213,8 @@ export class Users extends Base {
return null;
}

// get next agent ignoring the ones reached the max amount of active chats
getUnavailableAgents(departmentId, customFilter) {
const col = this.model.rawCollection();
// if department is provided, remove the agents that are not from the selected department
const departmentFilter = departmentId ? [{
$lookup: {
from: 'rocketchat_livechat_department_agent',
let: { departmentId: '$departmentId', agentId: '$agentId' },
pipeline: [{
$match: { $expr: { $eq: ['$$agentId', '$_id'] } },
}, {
$match: { $expr: { $eq: ['$$departmentId', departmentId] } },
}],
as: 'department',
},
}, {
$match: { department: { $size: 1 } },
}] : [];

return col.aggregate([
{
$match: {
status: { $exists: true, $ne: 'offline' },
statusLivechat: 'available',
roles: 'livechat-agent',
},
},
...departmentFilter,
{
$lookup: {
from: 'rocketchat_subscription',
localField: '_id',
foreignField: 'u._id',
as: 'subs',
},
},
{
$project: {
agentId: '$_id',
'livechat.maxNumberSimultaneousChat': 1,
username: 1,
lastAssignTime: 1,
lastRoutingTime: 1,
'queueInfo.chats': {
$size: {
$filter: {
input: '$subs',
as: 'sub',
cond: {
$and: [
{ $eq: ['$$sub.t', 'l'] },
{ $eq: ['$$sub.open', true] },
{ $ne: ['$$sub.onHold', true] },
],
},
},
},
},
},
},
...customFilter ? [customFilter] : [],
{
$sort: {
'queueInfo.chats': 1,
lastAssignTime: 1,
lastRoutingTime: 1,
username: 1,
},
},
]).toArray();
getUnavailableAgents() {
return [];
}


Expand Down
2 changes: 1 addition & 1 deletion app/utils/rocketchat.info
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "3.17.1"
"version": "3.17.2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { callbacks } from '../../../../../app/callbacks/server';
import { LivechatDepartment } from '../../../../../app/models/server';
import { settings } from '../../../../../app/settings/server';

callbacks.add('livechat.applySimultaneousChatRestrictions', ({ departmentId }: { departmentId?: string }) => {
callbacks.add('livechat.applySimultaneousChatRestrictions', (_: any, { departmentId }: { departmentId?: string }) => {
if (departmentId) {
const departmentLimit = LivechatDepartment.findOneById(departmentId)?.maxNumberSimultaneousChat || 0;
if (departmentLimit > 0) {
Expand All @@ -22,12 +22,15 @@ callbacks.add('livechat.applySimultaneousChatRestrictions', ({ departmentId }: {
'livechat.maxNumberSimultaneousChat': { $exists: false },
},
{ 'livechat.maxNumberSimultaneousChat': 0 },
{ 'livechat.maxNumberSimultaneousChat': '' },
{ 'livechat.maxNumberSimultaneousChat': null },
],
},
{ 'queueInfo.chats': { $gte: maxChatsPerSetting } },
],
}
: {};
// dummy filter meaning: don't match anything
: { _id: '' };

return { $match: { $or: [agentFilter, globalFilter] } };
}, callbacks.priority.HIGH, 'livechat-apply-simultaneous-restrictions');
1 change: 1 addition & 0 deletions ee/app/models/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import './models/LivechatDepartment';
import './models/LivechatRooms';
import './models/LivechatInquiry';
import './models/Messages';
import './models/Users';
import './raw/LivechatRooms';
import './raw/LivechatDepartmentAgents';

Expand Down
Loading

0 comments on commit fe0e5e4

Please sign in to comment.