Skip to content

Commit

Permalink
Merge pull request RocketChat#16644 from RocketChat/release-3.0.1
Browse files Browse the repository at this point in the history
Release 3.0.1
  • Loading branch information
sampaiodiego authored Feb 19, 2020
2 parents ea3a31a + b87ffbb commit ef6932c
Show file tree
Hide file tree
Showing 18 changed files with 224 additions and 104 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.0
ENV RC_VERSION 3.0.1

MAINTAINER [email protected]

Expand Down
77 changes: 77 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -39745,6 +39745,83 @@
"4.0"
],
"pull_requests": []
},
"3.0.1": {
"node_version": "12.14.0",
"npm_version": "6.13.4",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "16624",
"title": "[FIX] UiKit not updating new actionIds received as responses from actions",
"userLogin": "ggazzo",
"milestone": "3.0.1",
"contributors": [
"ggazzo"
]
},
{
"pr": "16625",
"title": "[FIX] Regression: Jitsi on external window infinite loop",
"userLogin": "ggazzo",
"milestone": "3.0.1",
"contributors": [
"ggazzo"
]
},
{
"pr": "16623",
"title": "[FIX] livechat/rooms endpoint not working with big amount of livechats",
"userLogin": "MarcosSpessatto",
"milestone": "3.0.1",
"contributors": [
"MarcosSpessatto",
"sampaiodiego"
]
},
{
"pr": "16637",
"title": "[FIX] Regression: New 'app' role with no permissions when updating to 3.0.0",
"userLogin": "d-gubert",
"milestone": "3.0.1",
"contributors": [
"d-gubert"
]
},
{
"pr": "16626",
"title": "[FIX] Block user option inside admin view",
"userLogin": "ggazzo",
"milestone": "3.0.1",
"contributors": [
"ggazzo"
]
},
{
"pr": "16639",
"title": "[FIX] Data converters overriding fields added by apps",
"userLogin": "d-gubert",
"milestone": "3.0.1",
"contributors": [
"ggazzo",
"d-gubert",
"web-flow"
]
},
{
"pr": "16629",
"title": "[FIX] Admin height if the blue banner is opened",
"userLogin": "ggazzo",
"milestone": "3.0.1",
"contributors": [
"ggazzo"
]
}
]
}
}
}
25 changes: 25 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@

# 3.0.1
`2020-02-19 · 7 🐛 · 4 👩‍💻👨‍💻`

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

### 🐛 Bug fixes

- UiKit not updating new actionIds received as responses from actions ([#16624](https://github.com/RocketChat/Rocket.Chat/pull/16624))
- Regression: Jitsi on external window infinite loop ([#16625](https://github.com/RocketChat/Rocket.Chat/pull/16625))
- livechat/rooms endpoint not working with big amount of livechats ([#16623](https://github.com/RocketChat/Rocket.Chat/pull/16623))
- Regression: New 'app' role with no permissions when updating to 3.0.0 ([#16637](https://github.com/RocketChat/Rocket.Chat/pull/16637))
- Block user option inside admin view ([#16626](https://github.com/RocketChat/Rocket.Chat/pull/16626))
- Data converters overriding fields added by apps ([#16639](https://github.com/RocketChat/Rocket.Chat/pull/16639))
- Admin height if the blue banner is opened ([#16629](https://github.com/RocketChat/Rocket.Chat/pull/16629))

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

- [@MarcosSpessatto](https://github.com/MarcosSpessatto)
- [@d-gubert](https://github.com/d-gubert)
- [@ggazzo](https://github.com/ggazzo)
- [@sampaiodiego](https://github.com/sampaiodiego)

# 3.0.0
`2020-02-14 · 7 ️️️⚠️ · 10 🎉 · 11 🚀 · 32 🐛 · 43 🔍 · 21 👩‍💻👨‍💻`

Expand Down
6 changes: 4 additions & 2 deletions app/apps/lib/misc/transformMappedData.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ export const transformMappedData = (data, map) => {
if (typeof result !== 'undefined') {
transformedData[to] = result;
}
} else if (typeof from === 'string' && typeof originalData[from] !== 'undefined') {
transformedData[to] = originalData[from];
} else if (typeof from === 'string') {
if (typeof originalData[from] !== 'undefined') {
transformedData[to] = originalData[from];
}
delete originalData[from];
}
});
Expand Down
1 change: 1 addition & 0 deletions app/lib/server/functions/sendMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const validateMessage = (message) => {
emoji: String,
avatar: ValidPartialURLParam,
attachments: [Match.Any],
blocks: [Match.Any],
}));

if (Array.isArray(message.attachments) && message.attachments.length) {
Expand Down
33 changes: 20 additions & 13 deletions app/livechat/server/api/lib/rooms.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LivechatRooms } from '../../../../models/server/raw';
import { LivechatRooms, LivechatDepartment } from '../../../../models/server/raw';

export async function findRooms({
agents,
Expand All @@ -16,18 +16,7 @@ export async function findRooms({
sort,
},
}) {
const total = (await LivechatRooms.findRoomsWithCriteria({
agents,
roomName,
departmentId,
open,
createdAt,
closedAt,
tags,
customFields,
})).length;

const rooms = await LivechatRooms.findRoomsWithCriteria({
const cursor = LivechatRooms.findRoomsWithCriteria({
agents,
roomName,
departmentId,
Expand All @@ -44,6 +33,24 @@ export async function findRooms({
},
});

const total = await cursor.count();

const rooms = await cursor.toArray();

const departmentsIds = [...new Set(rooms.map((room) => room.departmentId).filter(Boolean))];
if (departmentsIds.length) {
const departments = await LivechatDepartment.findInIds(departmentsIds, { fields: { name: 1 } }).toArray();

rooms.forEach((room) => {
if (!room.departmentId) {
return;
}
const department = departments.find((dept) => dept._id === room.departmentId);
if (department) {
room.department = department;
}
});
}
return {
rooms,
count: rooms.length,
Expand Down
6 changes: 4 additions & 2 deletions app/models/server/raw/LivechatDepartment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { BaseRaw } from './BaseRaw';

export class LivechatDepartmentRaw extends BaseRaw {


findInIds(departmentsIds, options) {
const query = { _id: { $in: departmentsIds } };
return this.find(query, options);
}
}
58 changes: 15 additions & 43 deletions app/models/server/raw/LivechatRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1099,73 +1099,45 @@ export class LivechatRoomsRaw extends BaseRaw {
}

findRoomsWithCriteria({ agents, roomName, departmentId, open, createdAt, closedAt, tags, customFields, options = {} }) {
const match = {
$match: {
t: 'l',
},
const query = {
t: 'l',
};
if (agents) {
match.$match.$or = [{ 'servedBy._id': { $in: agents } }, { 'servedBy.username': { $in: agents } }];
query.$or = [{ 'servedBy._id': { $in: agents } }, { 'servedBy.username': { $in: agents } }];
}
if (roomName) {
match.$match.fname = new RegExp(roomName, 'i');
query.fname = new RegExp(roomName, 'i');
}
if (departmentId) {
match.$match.departmentId = departmentId;
query.departmentId = departmentId;
}
if (open !== undefined) {
match.$match.open = { $exists: open };
query.open = { $exists: open };
}
if (createdAt) {
match.$match.ts = {};
query.ts = {};
if (createdAt.start) {
match.$match.ts.$gte = new Date(createdAt.start);
query.ts.$gte = new Date(createdAt.start);
}
if (createdAt.end) {
match.$match.ts.$lte = new Date(createdAt.end);
query.ts.$lte = new Date(createdAt.end);
}
}
if (closedAt) {
match.$match.closedAt = {};
query.closedAt = {};
if (closedAt.start) {
match.$match.closedAt.$gte = new Date(closedAt.start);
query.closedAt.$gte = new Date(closedAt.start);
}
if (closedAt.end) {
match.$match.closedAt.$lte = new Date(closedAt.end);
query.closedAt.$lte = new Date(closedAt.end);
}
}
if (tags) {
match.$match.tags = { $in: tags };
query.tags = { $in: tags };
}
if (customFields) {
match.$match.$and = Object.keys(customFields).map((key) => ({ [`livechatData.${ key }`]: new RegExp(customFields[key], 'i') }));
}
const sort = { $sort: options.sort || { name: 1 } };
const firstParams = [match, sort];
if (options.offset) {
firstParams.push({ $skip: options.offset });
query.$and = Object.keys(customFields).map((key) => ({ [`livechatData.${ key }`]: new RegExp(customFields[key], 'i') }));
}
if (options.count) {
firstParams.push({ $limit: options.count });
}
const lookup = {
$lookup: {
from: 'rocketchat_livechat_department',
localField: 'departmentId',
foreignField: '_id',
as: 'department',
},
};
const unwind = {
$unwind: {
path: '$department',
preserveNullAndEmptyArrays: true,
},
};
const params = [...firstParams, lookup, unwind];
if (options.fields) {
params.push({ $project: options.fields });
}
return this.col.aggregate(params).toArray();
return this.find(query, { sort: options.sort || { name: 1 }, skip: options.offset, limit: options.count });
}
}
8 changes: 4 additions & 4 deletions app/ui-flextab/client/tabs/userActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ const canBlockUser = () =>
ChatSubscription.findOne({ rid: Session.get('openedRoom'), 'u._id': Meteor.userId() }, { fields: { blocker: 1 } })
.blocker;

const canDirectMessageTo = (username) => {
const canDirectMessageTo = (username, directActions) => {
const subscription = Subscriptions.findOne({ rid: Session.get('openedRoom') });
const canOpenDm = hasAllPermission('create-d') || Subscriptions.findOne({ name: username });
const dmIsNotAlreadyOpen = subscription && subscription.name !== username;
return canOpenDm && dmIsNotAlreadyOpen;
return canOpenDm && (!directActions || dmIsNotAlreadyOpen);
};

export const getActions = ({ user, directActions, hideAdminControls }) => {
Expand Down Expand Up @@ -107,7 +107,7 @@ export const getActions = ({ user, directActions, hideAdminControls }) => {
Meteor.call('createDirectMessage', username, success((result) => result.rid && FlowRouter.go('direct', { username }, FlowRouter.current().queryParams))),
),
condition() {
return canDirectMessageTo(this.username);
return canDirectMessageTo(this.username, directActions);
},
},

Expand Down Expand Up @@ -188,7 +188,7 @@ export const getActions = ({ user, directActions, hideAdminControls }) => {
},
};
}, function() {
if (!isInDirectMessageRoom() || isSelf(this.username)) {
if (!directActions || !isInDirectMessageRoom() || isSelf(this.username)) {
return;
}
if (canBlockUser()) {
Expand Down
6 changes: 3 additions & 3 deletions app/ui-message/client/blocks/ModalBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Template.ModalBlock.onRendered(async function() {
appId,
viewId,
view: {
...this.data.view,
...state.get().view,
id: viewId,
state: groupStateByBlockId(this.state.all()),
},
Expand All @@ -91,7 +91,7 @@ Template.ModalBlock.onRendered(async function() {
appId,
viewId,
view: {
...this.data.view,
...state.get().view,
id: viewId,
state: groupStateByBlockId(this.state.all()),
},
Expand All @@ -105,7 +105,7 @@ Template.ModalBlock.onRendered(async function() {
appId,
payload: {
view: {
...this.data.view,
...state.get().view,
id: viewId,
state: groupStateByBlockId(this.state.all()),
},
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.0.0"
"version": "3.0.1"
}
Loading

0 comments on commit ef6932c

Please sign in to comment.