Skip to content

Commit

Permalink
Merge pull request #17019 from RocketChat/release-3.0.7
Browse files Browse the repository at this point in the history
Release 3.0.7
  • Loading branch information
sampaiodiego authored Mar 25, 2020
2 parents fcbfa9b + 5e4bd07 commit f69d169
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 40 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/rhscl/nodejs-8-rhel7

ENV RC_VERSION 3.0.6
ENV RC_VERSION 3.0.7

MAINTAINER buildmaster@rocket.chat

Expand Down
20 changes: 20 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -40047,6 +40047,26 @@
]
}
]
},
"3.0.7": {
"node_version": "12.14.0",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "17017",
"title": "Regression: Remove deprecated Omnichannel setting used to fetch the queue data through subscription ",
"userLogin": "renatobecker",
"milestone": "3.1.0",
"contributors": [
"renatobecker"
]
}
]
}
}
}
19 changes: 19 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@

# 3.0.7
`2020-03-25 · 1 🔍 · 1 👩‍💻👨‍💻`

### Engine versions
- Node: `12.14.0`
- NPM: `6.13.4`
- MongoDB: `3.4, 3.6, 4.0`

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

- Regression: Remove deprecated Omnichannel setting used to fetch the queue data through subscription ([#17017](https://github.com/RocketChat/Rocket.Chat/pull/17017))

</details>

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

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

# 3.0.6
`2020-03-25 · 1 🐛 · 1 🔍 · 1 👩‍💻👨‍💻`

Expand Down
10 changes: 1 addition & 9 deletions app/livechat/client/collections/LivechatInquiry.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import { Mongo } from 'meteor/mongo';

import { settings } from '../../../settings/client';

let collection;
export const getLivechatInquiryCollection = () => {
if (!collection) {
collection = new Mongo.Collection(settings.get('Livechat_enable_inquiry_fetch_by_stream') ? null : 'rocketchat_livechat_inquiry');
}
return collection;
};
export const LivechatInquiry = new Mongo.Collection(null);
17 changes: 9 additions & 8 deletions app/livechat/client/lib/stream/queueManager.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import { APIClient } from '../../../../utils/client';
import { getLivechatInquiryCollection } from '../../collections/LivechatInquiry';
import { LivechatInquiry } from '../../collections/LivechatInquiry';
import { inquiryDataStream } from './inquiry';
import { hasRole } from '../../../../authorization/client';

let agentDepartments = [];
const collection = getLivechatInquiryCollection();

const events = {
added: (inquiry) => {
delete inquiry.type;
collection.insert(inquiry);
LivechatInquiry.insert(inquiry);
},
changed: (inquiry) => {
if (inquiry.status !== 'queued' || (inquiry.department && !agentDepartments.includes(inquiry.department))) {
return collection.remove(inquiry._id);
return LivechatInquiry.remove(inquiry._id);
}
delete inquiry.type;
collection.upsert({ _id: inquiry._id }, inquiry);
LivechatInquiry.upsert({ _id: inquiry._id }, inquiry);
},
removed: (inquiry) => collection.remove(inquiry._id),
removed: (inquiry) => LivechatInquiry.remove(inquiry._id),
};

const updateCollection = (inquiry) => { events[inquiry.type](inquiry); };
Expand All @@ -31,7 +30,7 @@ const getInquiriesFromAPI = async (url) => {
};

const updateInquiries = async (inquiries) => {
(inquiries || []).forEach((inquiry) => collection.upsert({ _id: inquiry._id }, inquiry));
(inquiries || []).forEach((inquiry) => LivechatInquiry.upsert({ _id: inquiry._id }, inquiry));
};

const getAgentsDepartments = async (userId) => {
Expand All @@ -54,12 +53,14 @@ const removeGlobalListener = () => {
};

export const initializeLivechatInquiryStream = async (userId) => {
collection.remove({});
LivechatInquiry.remove({});

if (agentDepartments.length) {
removeDepartmentsListeners(agentDepartments);
}
removeGlobalListener();
await updateInquiries(await getInquiriesFromAPI('livechat/inquiries.queued?sort={"ts": 1}'));

agentDepartments = (await getAgentsDepartments(userId)).map((department) => department.departmentId);
await addListenerForeachDepartment(userId, agentDepartments);
if (agentDepartments.length === 0 || hasRole(userId, 'livechat-manager')) {
Expand Down
11 changes: 4 additions & 7 deletions app/livechat/client/views/sideNav/livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { KonchatNotification } from '../../../../ui';
import { settings } from '../../../../settings';
import { hasPermission } from '../../../../authorization';
import { t, handleError, getUserPreference } from '../../../../utils';
import { getLivechatInquiryCollection } from '../../collections/LivechatInquiry';
import { LivechatInquiry } from '../../collections/LivechatInquiry';
import { Notifications } from '../../../../notifications/client';
import { initializeLivechatInquiryStream } from '../../lib/stream/queueManager';

Expand Down Expand Up @@ -50,7 +50,7 @@ Template.livechat.helpers({
},

inquiries() {
const inqs = getLivechatInquiryCollection().find({
const inqs = LivechatInquiry.find({
status: 'queued',
}, {
sort: {
Expand Down Expand Up @@ -131,11 +131,8 @@ Template.livechat.onCreated(function() {
this.statusLivechat.set();
}
});
if (!settings.get('Livechat_enable_inquiry_fetch_by_stream')) {
this.subscribe('livechat:inquiry');
} else {
initializeLivechatInquiryStream(Meteor.userId());
}

initializeLivechatInquiryStream(Meteor.userId());
this.updateAgentDepartments = () => initializeLivechatInquiryStream(Meteor.userId());
this.autorun(() => this.inquiriesLimit.set(settings.get('Livechat_guest_pool_max_number_incoming_livechats_displayed')));

Expand Down
8 changes: 4 additions & 4 deletions app/livechat/lib/LivechatRoomType.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { openRoom } from '../../ui-utils';
import { RoomSettingsEnum, UiTextContext, RoomTypeRouteConfig, RoomTypeConfig } from '../../utils';
import { getAvatarURL } from '../../utils/lib/getAvatarURL';

let getLivechatInquiryCollection;
let LivechatInquiry;
if (Meteor.isClient) {
({ getLivechatInquiryCollection } = require('../client/collections/LivechatInquiry'));
({ LivechatInquiry } = require('../client/collections/LivechatInquiry'));
}

class LivechatRoomRoute extends RoomTypeRouteConfig {
Expand Down Expand Up @@ -68,7 +68,7 @@ export default class LivechatRoomType extends RoomTypeConfig {
if (room) {
return room.v && room.v.status;
}
const inquiry = getLivechatInquiryCollection().findOne({ rid });
const inquiry = LivechatInquiry.findOne({ rid });
return inquiry && inquiry.v && inquiry.v.status;
}

Expand Down Expand Up @@ -98,7 +98,7 @@ export default class LivechatRoomType extends RoomTypeConfig {
return true;
}

const inquiry = getLivechatInquiryCollection().findOne({ rid }, { fields: { status: 1 } });
const inquiry = LivechatInquiry.findOne({ rid }, { fields: { status: 1 } });
if (inquiry && inquiry.status === 'queued') {
return true;
}
Expand Down
9 changes: 0 additions & 9 deletions app/livechat/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,4 @@ Meteor.startup(function() {
i18nLabel: 'How_long_to_wait_to_consider_visitor_abandonment',
i18nDescription: 'Time_in_seconds',
});

settings.add('Livechat_enable_inquiry_fetch_by_stream', true, {
type: 'boolean',
group: 'Livechat',
section: 'Routing',
public: true,
i18nLabel: 'Enable_inquiry_fetch_by_stream',
enableQuery: { _id: 'Livechat_Routing_Method', value: 'Manual_Selection' },
});
});
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.0.6"
"version": "3.0.7"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Rocket.Chat",
"description": "The Ultimate Open Source WebChat Platform",
"version": "3.0.6",
"version": "3.0.7",
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
Expand Down
14 changes: 14 additions & 0 deletions server/startup/migrations/v178.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
Migrations,
} from '../../../app/migrations';
import {
Settings,
} from '../../../app/models';


Migrations.add({
version: 178,
up() {
Settings.remove({ _id: 'Livechat_enable_inquiry_fetch_by_stream' });
},
});

0 comments on commit f69d169

Please sign in to comment.