Skip to content
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

Release 3.6.1 #18867

Merged
merged 8 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.6.0
ENV RC_VERSION 3.6.1

MAINTAINER [email protected]

Expand Down
89 changes: 78 additions & 11 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -15363,14 +15363,6 @@
]
},
"HEAD": {
"node_version": "12.16.1",
"npm_version": "6.14.0",
"apps_engine_version": "1.17.0",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": []
},
"0.66.0-rc.0": {
Expand Down Expand Up @@ -48026,8 +48018,8 @@
]
}
]
},
"3.6.0-rc.0": {
},
"3.6.0-rc.0": {
"node_version": "12.16.1",
"npm_version": "6.14.0",
"apps_engine_version": "1.17.0-beta.3629",
Expand Down Expand Up @@ -49197,6 +49189,81 @@
]
}
]
},
"3.6.1": {
"node_version": "12.16.1",
"npm_version": "6.14.0",
"apps_engine_version": "1.17.0",
"mongo_versions": [
"3.4",
"3.6",
"4.0"
],
"pull_requests": [
{
"pr": "18862",
"title": "[FIX] Showing alerts during setup wizard",
"userLogin": "sampaiodiego",
"milestone": "3.6.1",
"contributors": [
"sampaiodiego"
]
},
{
"pr": "18852",
"title": "[FIX] User can't invite or join other Omnichannel rooms",
"userLogin": "renatobecker",
"milestone": "3.6.1",
"contributors": [
"renatobecker"
]
},
{
"pr": "18851",
"title": "[FIX] User administration throwing a blank page if user has no role",
"userLogin": "ggazzo",
"milestone": "3.6.1",
"contributors": [
"ggazzo"
]
},
{
"pr": "18850",
"title": "[FIX] IE11 support livechat widget",
"userLogin": "ggazzo",
"milestone": "3.6.1",
"contributors": [
"ggazzo"
]
},
{
"pr": "18841",
"title": "[FIX] File upload (Avatars, Emoji, Sounds)",
"userLogin": "ggazzo",
"milestone": "3.6.1",
"contributors": [
"ggazzo"
]
},
{
"pr": "18835",
"title": "[FIX][ENTERPRISE] Omnichannel service status switching to unavailable",
"userLogin": "renatobecker",
"milestone": "3.6.1",
"contributors": [
"renatobecker"
]
},
{
"pr": "18795",
"title": "[FIX] Omnichannel Current Chats open status filter not working",
"userLogin": "renatobecker",
"milestone": "3.6.1",
"contributors": [
"renatobecker"
]
}
]
}
}
}
}
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.6.0/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/3.6.1/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.6.0
version: 3.6.1
summary: Rocket.Chat server
description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/
confinement: strict
Expand Down
32 changes: 32 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@

# 3.6.1
`2020-09-11 · 7 🐛 · 3 👩‍💻👨‍💻`

### Engine versions
- Node: `12.16.1`
- NPM: `6.14.0`
- MongoDB: `3.4, 3.6, 4.0`
- Apps-Engine: `1.17.0`

### 🐛 Bug fixes


- **ENTERPRISE:** Omnichannel service status switching to unavailable ([#18835](https://github.com/RocketChat/Rocket.Chat/pull/18835))

- File upload (Avatars, Emoji, Sounds) ([#18841](https://github.com/RocketChat/Rocket.Chat/pull/18841))

- IE11 support livechat widget ([#18850](https://github.com/RocketChat/Rocket.Chat/pull/18850))

- Omnichannel Current Chats open status filter not working ([#18795](https://github.com/RocketChat/Rocket.Chat/pull/18795))

- Showing alerts during setup wizard ([#18862](https://github.com/RocketChat/Rocket.Chat/pull/18862))

- User administration throwing a blank page if user has no role ([#18851](https://github.com/RocketChat/Rocket.Chat/pull/18851))

- User can't invite or join other Omnichannel rooms ([#18852](https://github.com/RocketChat/Rocket.Chat/pull/18852))

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

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

# 3.6.0
`2020-08-29 · 10 🎉 · 5 🚀 · 26 🐛 · 36 🔍 · 23 👩‍💻👨‍💻`

Expand Down
28 changes: 22 additions & 6 deletions app/2fa/server/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function getUserForCheck(userId: string): IUser {
fields: {
emails: 1,
language: 1,
createdAt: 1,
'services.totp': 1,
'services.email2fa': 1,
'services.emailCode': 1,
Expand All @@ -61,6 +62,19 @@ export function getFingerprintFromConnection(connection: IMethodConnection): str
return crypto.createHash('md5').update(data).digest('hex');
}

function getRememberDate(from: Date = new Date()): Date | undefined {
const rememberFor = parseInt(settings.get('Accounts_TwoFactorAuthentication_RememberFor') as string, 10);

if (rememberFor <= 0) {
return;
}

const expires = new Date(from);
expires.setSeconds(expires.getSeconds() + rememberFor);

return expires;
}

export function isAuthorizedForToken(connection: IMethodConnection, user: IUser, options: ITwoFactorOptions): boolean {
const currentToken = Accounts._getLoginToken(connection.id);
const tokenObject = user.services?.resume?.loginTokens?.find((i) => i.hashedToken === currentToken);
Expand All @@ -77,6 +91,12 @@ export function isAuthorizedForToken(connection: IMethodConnection, user: IUser,
return false;
}

// remember user right after their registration
const rememberAfterRegistration = user.createdAt && getRememberDate(user.createdAt);
if (rememberAfterRegistration && rememberAfterRegistration >= new Date()) {
return true;
}

if (!tokenObject.twoFactorAuthorizedUntil || !tokenObject.twoFactorAuthorizedHash) {
return false;
}
Expand All @@ -95,15 +115,11 @@ export function isAuthorizedForToken(connection: IMethodConnection, user: IUser,
export function rememberAuthorization(connection: IMethodConnection, user: IUser): void {
const currentToken = Accounts._getLoginToken(connection.id);

const rememberFor = parseInt(settings.get('Accounts_TwoFactorAuthentication_RememberFor') as string, 10);

if (rememberFor <= 0) {
const expires = getRememberDate();
if (!expires) {
return;
}

const expires = new Date();
expires.setSeconds(expires.getSeconds() + rememberFor);

Users.setTwoFactorAuthorizationHashAndUntilForUserIdAndToken(user._id, currentToken, getFingerprintFromConnection(connection), expires);
}

Expand Down
2 changes: 1 addition & 1 deletion app/lib/server/functions/addUserToRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const addUserToRoom = function(rid, user, inviter, silenced) {
throw error;
}

if (room.t === 'c' || room.t === 'p') {
if (room.t === 'c' || room.t === 'p' || room.t === 'l') {
// Add a new event, with an optional inviter
callbacks.run('beforeAddedToRoom', { user, inviter }, room);

Expand Down
2 changes: 1 addition & 1 deletion app/lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2679,7 +2679,7 @@ settings.addGroup('Setup_Wizard', function() {
this.add('Allow_Marketing_Emails', true, {
type: 'boolean',
});
this.add('Register_Server', true, {
this.add('Register_Server', false, {
type: 'boolean',
});
this.add('Organization_Email', '', {
Expand Down
6 changes: 5 additions & 1 deletion app/livechat/lib/LivechatRoomType.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ChatRoom } from '../../models';
import { settings } from '../../settings';
import { hasPermission } from '../../authorization';
import { openRoom } from '../../ui-utils';
import { RoomSettingsEnum, UiTextContext, RoomTypeRouteConfig, RoomTypeConfig } from '../../utils';
import { RoomMemberActions, RoomSettingsEnum, UiTextContext, RoomTypeRouteConfig, RoomTypeConfig } from '../../utils';
import { getAvatarURL } from '../../utils/lib/getAvatarURL';

let LivechatInquiry;
Expand Down Expand Up @@ -85,6 +85,10 @@ export default class LivechatRoomType extends RoomTypeConfig {
}
}

allowMemberAction(room, action) {
return [RoomMemberActions.INVITE, RoomMemberActions.JOIN].includes(action);
}

getUiText(context) {
switch (context) {
case UiTextContext.HIDE_WARNING:
Expand Down
8 changes: 8 additions & 0 deletions app/livechat/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ Meteor.startup(async () => {
}));
}, callbacks.priority.LOW, 'cant-leave-room');

callbacks.add('beforeJoinRoom', function(user, room) {
if (room.t === 'l' && !hasPermission(user._id, 'view-l-room')) {
throw new Meteor.Error('error-user-is-not-agent', 'User is not an Omnichannel Agent', { method: 'beforeJoinRoom' });
}

return user;
}, callbacks.priority.LOW, 'cant-join-room');

createLivechatQueueView();

const monitor = new LivechatAgentActivityMonitor();
Expand Down
2 changes: 1 addition & 1 deletion app/tokenpass/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Meteor.startup(function() {
throw new Meteor.Error('error-not-allowed', 'Token required', { method: 'joinRoom' });
}

return room;
return user;
});
});

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.6.0"
"version": "3.6.1"
}
4 changes: 3 additions & 1 deletion client/admin/users/UserInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ export function UserInfoWithData({ uid, username, ...props }) {
return <Box mbs='x16'>{t('User_not_found')}</Box>;
}

const admin = data.user?.roles?.includes('admin');

return <UserInfo
{...user}
data={data.user}
onChange={onChange}
actions={data && data.user && <UserInfoActions isActive={data.user.active} isAdmin={data.user.roles.includes('admin')} _id={data.user._id} username={data.user.username} onChange={onChange}/>}
actions={data && data.user && <UserInfoActions isActive={data.user.active} isAdmin={admin} _id={data.user._id} username={data.user.username} onChange={onChange}/>}
{...props}
/>;
}
6 changes: 3 additions & 3 deletions client/contexts/ServerContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type ServerContextValue = {
absoluteUrl: (path: string) => string;
callMethod: (methodName: string, ...args: any[]) => Promise<any>;
callEndpoint: (httpMethod: 'GET' | 'POST' | 'DELETE', endpoint: string, ...args: any[]) => Promise<any>;
uploadToEndpoint: (endpoint: string) => Promise<void>;
uploadToEndpoint: (endpoint: string, params: any, formData: any) => Promise<void>;
getStream: (streamName: string, options?: {}) => IServerStream;
};

Expand Down Expand Up @@ -40,9 +40,9 @@ export const useEndpoint = (httpMethod: 'GET' | 'POST' | 'DELETE', endpoint: str
return useCallback((...args: any[]) => callEndpoint(httpMethod, endpoint, ...args), [callEndpoint, httpMethod, endpoint]);
};

export const useUpload = (endpoint: string): () => Promise<void> => {
export const useUpload = (endpoint: string): (params: any, formData: any) => Promise<void> => {
const { uploadToEndpoint } = useContext(ServerContext);
return useCallback(() => uploadToEndpoint(endpoint), [endpoint, uploadToEndpoint]);
return useCallback((params, formData: any) => uploadToEndpoint(endpoint, params, formData), [endpoint, uploadToEndpoint]);
};

export const useStream = (streamName: string, options?: {}): IServerStream => {
Expand Down
4 changes: 2 additions & 2 deletions client/hooks/useFileInput.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { useRef, useEffect } from 'react';

export const useFileInput = (onSetFile, fileType = 'image/*') => {
export const useFileInput = (onSetFile, fileType = 'image/*', fileField = 'image') => {
const ref = useRef();

useEffect(() => {
Expand All @@ -14,7 +14,7 @@ export const useFileInput = (onSetFile, fileType = 'image/*') => {

ref.current = fileInput;
const handleFiles = () => {
formData.append(fileType, fileInput.files[0]);
formData.append(fileField, fileInput.files[0]);
onSetFile(fileInput.files[0], formData);
};
fileInput.addEventListener('change', handleFiles, false);
Expand Down
2 changes: 1 addition & 1 deletion client/hooks/useUpdateAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useUpdateAvatar = (avatarObj, userId) => {

const saveAvatarQuery = useMemo(() => ({
userId,
avatarUrl,
...avatarUrl && { avatarUrl },
}), [avatarUrl, userId]);

const resetAvatarQuery = useMemo(() => ({
Expand Down
2 changes: 1 addition & 1 deletion client/omnichannel/currentChats/CurrentChatsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const useQuery = ({ guest, servedBy, department, status, from, to, tags, customF
query.createdAt = JSON.stringify({ start: from, end: to });
}
if (status !== 'all') {
query.open = status === 'open';
query.open = status === 'opened';
}
if (servedBy && servedBy !== 'all') {
query.agents = [servedBy];
Expand Down
4 changes: 3 additions & 1 deletion ee/app/livechat-enterprise/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ Meteor.startup(async function() {
});
settings.onload('Livechat_business_hour_type', (_, value) => {
businessHourManager.registerBusinessHourBehavior(businessHours[value]);
businessHourManager.startManager();
if (settings.get('Livechat_enable_business_hours')) {
businessHourManager.startManager();
}
});
await resetDefaultBusinessHourIfNeeded();
});
Loading