Skip to content

Commit

Permalink
Merge pull request #32934 from RocketChat/release-6.10.2
Browse files Browse the repository at this point in the history
Release 6.10.2
  • Loading branch information
sampaiodiego authored Jul 31, 2024
2 parents 636382f + 7d9bb11 commit 721908c
Show file tree
Hide file tree
Showing 24 changed files with 142 additions and 81 deletions.
5 changes: 5 additions & 0 deletions .changeset/bump-patch-1722288752329.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Bump @rocket.chat/meteor version.
13 changes: 13 additions & 0 deletions .changeset/cold-chairs-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'rocketchat-services': patch
'@rocket.chat/fuselage-ui-kit': patch
'@rocket.chat/core-services': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/rest-typings': patch
'@rocket.chat/ddp-streamer': patch
'@rocket.chat/presence': patch
'@rocket.chat/apps': patch
'@rocket.chat/meteor': patch
---

Fixed an issue that prevented apps from being updated or uninstalled in some cases
13 changes: 13 additions & 0 deletions .changeset/early-trains-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'rocketchat-services': patch
'@rocket.chat/fuselage-ui-kit': patch
'@rocket.chat/core-services': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/rest-typings': patch
'@rocket.chat/ddp-streamer': patch
'@rocket.chat/presence': patch
'@rocket.chat/apps': patch
'@rocket.chat/meteor': patch
---

Fixed an issue that prevented apps from handling errors during execution in some cases
13 changes: 13 additions & 0 deletions .changeset/fair-wasps-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'rocketchat-services': patch
'@rocket.chat/fuselage-ui-kit': patch
'@rocket.chat/core-services': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/rest-typings': patch
'@rocket.chat/ddp-streamer': patch
'@rocket.chat/presence': patch
'@rocket.chat/apps': patch
'@rocket.chat/meteor': patch
---

Improved Apps-Engine installation to prevent start up errors on manual installation setups
7 changes: 7 additions & 0 deletions .changeset/new-balloons-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@rocket.chat/meteor': patch
---

Fixed a crash on web client due to service workers not being available, this can happen in multiple scenarios like on Firefox's private window or if the connection is not secure (non-HTTPS), [see more details](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).

Rocket.Chat needs service workers to process E2EE encrypted files on rooms. These types of files won't be available inside private windows, but the rest of E2EE encrypted features should work normally
13 changes: 13 additions & 0 deletions .changeset/soft-toys-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'rocketchat-services': patch
'@rocket.chat/fuselage-ui-kit': patch
'@rocket.chat/core-services': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/rest-typings': patch
'@rocket.chat/ddp-streamer': patch
'@rocket.chat/presence': patch
'@rocket.chat/apps': patch
'@rocket.chat/meteor': patch
---

Fixed an issue that caused the video conference button on rooms to not recognize a video conference provider app in some cases
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ import '@testing-library/jest-dom/extend-expect';

import { createRenteionPolicySettingsMock as createMock } from '../../../tests/mocks/client/mockRetentionPolicySettings';
import { createFakeRoom } from '../../../tests/mocks/data';
import { setDate } from '../../../tests/mocks/mockDate';
import RetentionPolicyCallout from './RetentionPolicyCallout';

jest.useFakeTimers();

beforeEach(() => {
jest.setSystemTime(new Date(2024, 5, 1, 0, 0, 0));
});

describe('RetentionPolicyCallout', () => {
it('Should render callout if settings are valid', () => {
setDate();
const fakeRoom = createFakeRoom({ t: 'c' });
render(<RetentionPolicyCallout room={fakeRoom} />, { wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000 }) });
expect(screen.getByRole('alert')).toHaveTextContent('a minute June 1, 2024, 12:30 AM');
});

it('Should not render callout if settings are invalid', () => {
setDate();
const fakeRoom = createFakeRoom({ t: 'c' });
render(<RetentionPolicyCallout room={fakeRoom} />, {
wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000, advancedPrecisionCron: '* * * 12 *', advancedPrecision: true }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import Action from '../../Action';

type AttachmentDownloadBaseProps = Omit<ComponentProps<typeof Action>, 'icon'> & { title?: string | undefined; href: string };

const AttachmentDownloadBase: FC<AttachmentDownloadBaseProps> = ({ title, href, ...props }) => {
const AttachmentDownloadBase: FC<AttachmentDownloadBaseProps> = ({ title, href, disabled, ...props }) => {
const t = useTranslation();

return (
<Action
icon='cloud-arrow-down'
href={`${href}?download`}
title={t('Download')}
title={disabled ? t('Download_Disabled') : t('Download')}
is='a'
target='_blank'
rel='noopener noreferrer'
download={title}
disabled={disabled}
{...props}
/>
);
Expand Down
23 changes: 15 additions & 8 deletions apps/meteor/client/hooks/useDownloadFromServiceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import { downloadAs } from '../lib/download';

const ee = new Emitter<Record<string, { result: ArrayBuffer; id: string }>>();

navigator.serviceWorker.addEventListener('message', (event) => {
if (event.data.type === 'attachment-download-result') {
const { result } = event.data as { result: ArrayBuffer; id: string };
if ('serviceWorker' in navigator) {
navigator.serviceWorker.addEventListener('message', (event) => {
if (event.data.type === 'attachment-download-result') {
const { result } = event.data as { result: ArrayBuffer; id: string };

ee.emit(event.data.id, { result, id: event.data.id });
}
});
ee.emit(event.data.id, { result, id: event.data.id });
}
});
}

export const registerDownloadForUid = (uid: string, t: ReturnType<typeof useTranslation>['t'], title?: string) => {
ee.once(uid, ({ result }) => {
Expand All @@ -23,8 +25,13 @@ export const registerDownloadForUid = (uid: string, t: ReturnType<typeof useTran

export const forAttachmentDownload = (uid: string, href: string, controller?: ServiceWorker | null) => {
if (!controller) {
controller = navigator.serviceWorker.controller;
controller = navigator?.serviceWorker?.controller;
}

if (!controller) {
return;
}

controller?.postMessage({
type: 'attachment-download',
url: href,
Expand All @@ -33,7 +40,7 @@ export const forAttachmentDownload = (uid: string, href: string, controller?: Se
};

export const useDownloadFromServiceWorker = (href: string, title?: string) => {
const { controller } = navigator.serviceWorker;
const { controller } = navigator?.serviceWorker || {};

const uid = useUniqueId();

Expand Down
18 changes: 4 additions & 14 deletions apps/meteor/client/hooks/usePruneWarningMessage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { renderHook } from '@testing-library/react-hooks';

import { createRenteionPolicySettingsMock as createMock } from '../../tests/mocks/client/mockRetentionPolicySettings';
import { createFakeRoom } from '../../tests/mocks/data';
import { setDate } from '../../tests/mocks/mockDate';
import { usePruneWarningMessage } from './usePruneWarningMessage';

jest.useFakeTimers();
Expand All @@ -22,10 +21,13 @@ const getRetentionRoomProps = (props: Partial<IRoomWithRetentionPolicy['retentio
};
};

beforeEach(() => {
jest.setSystemTime(new Date(2024, 5, 1, 0, 0, 0));
});

describe('usePruneWarningMessage hook', () => {
describe('Cron timer and precision', () => {
it('Should update the message after the nextRunDate has passaed', async () => {
setDate();
const fakeRoom = createFakeRoom({ t: 'c' });
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
Expand All @@ -40,7 +42,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the default warning with precision set to every_hour', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
appliesToChannels: true,
Expand All @@ -53,7 +54,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the default warning with precision set to every_six_hours', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
appliesToChannels: true,
Expand All @@ -66,7 +66,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the default warning with precision set to every_day', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
appliesToChannels: true,
Expand All @@ -79,7 +78,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the default warning with advanced precision', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
appliesToChannels: true,
Expand All @@ -95,7 +93,6 @@ describe('usePruneWarningMessage hook', () => {
describe('No override', () => {
it('Should return the default warning', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
appliesToChannels: true,
Expand All @@ -107,7 +104,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the unpinned messages warning', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
appliesToChannels: true,
Expand All @@ -120,7 +116,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the files only warning', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();

const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
Expand All @@ -134,7 +129,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the unpinned files only warning', () => {
const fakeRoom = createFakeRoom({ t: 'c' });
setDate();

const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock({
Expand All @@ -151,7 +145,6 @@ describe('usePruneWarningMessage hook', () => {
describe('Overriden', () => {
it('Should return the default warning', () => {
const fakeRoom = createFakeRoom({ t: 'p', ...getRetentionRoomProps() });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock(),
});
Expand All @@ -160,7 +153,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the unpinned messages warning', () => {
const fakeRoom = createFakeRoom({ t: 'p', ...getRetentionRoomProps({ excludePinned: true }) });
setDate();
const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock(),
});
Expand All @@ -169,7 +161,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the files only warning', () => {
const fakeRoom = createFakeRoom({ t: 'p', ...getRetentionRoomProps({ filesOnly: true }) });
setDate();

const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock(),
Expand All @@ -179,7 +170,6 @@ describe('usePruneWarningMessage hook', () => {

it('Should return the unpinned files only warning', () => {
const fakeRoom = createFakeRoom({ t: 'p', ...getRetentionRoomProps({ excludePinned: true, filesOnly: true }) });
setDate();

const { result } = renderHook(() => usePruneWarningMessage(fakeRoom), {
wrapper: createMock(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ import '@testing-library/jest-dom/extend-expect';

import { createRenteionPolicySettingsMock as createMock } from '../../../../tests/mocks/client/mockRetentionPolicySettings';
import { createFakeRoom } from '../../../../tests/mocks/data';
import { setDate } from '../../../../tests/mocks/mockDate';
import RetentionPolicyWarning from './RetentionPolicyWarning';

jest.useFakeTimers();

beforeEach(() => {
jest.setSystemTime(new Date(2024, 5, 1, 0, 0, 0));
});

describe('RetentionPolicyWarning', () => {
it('Should render callout if settings are valid', () => {
setDate();
const fakeRoom = createFakeRoom({ t: 'c' });
render(<RetentionPolicyWarning room={fakeRoom} />, { wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000 }) });
expect(screen.getByRole('alert')).toHaveTextContent('a minute June 1, 2024, 12:30 AM');
});

it('Should not render callout if settings are invalid', () => {
setDate();
const fakeRoom = createFakeRoom({ t: 'c' });
render(<RetentionPolicyWarning room={fakeRoom} />, {
wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000, advancedPrecisionCron: '* * * 12 *', advancedPrecision: true }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ type FileItemMenuProps = {

const ee = new Emitter<Record<string, { result: ArrayBuffer; id: string }>>();

navigator.serviceWorker.addEventListener('message', (event) => {
if (event.data.type === 'attachment-download-result') {
const { result } = event.data as { result: ArrayBuffer; id: string };
if ('serviceWorker' in navigator) {
navigator.serviceWorker.addEventListener('message', (event) => {
if (event.data.type === 'attachment-download-result') {
const { result } = event.data as { result: ArrayBuffer; id: string };

ee.emit(event.data.id, { result, id: event.data.id });
}
});
ee.emit(event.data.id, { result, id: event.data.id });
}
});
}

const FileItemMenu = ({ fileData, onClickDelete }: FileItemMenuProps) => {
const t = useTranslation();
const room = useRoom();
const userId = useUserId();
const isDeletionAllowed = useMessageDeletionIsAllowed(room._id, fileData, userId);
const canDownloadFile = !fileData.encryption || 'serviceWorker' in navigator;

const { controller } = navigator.serviceWorker;
const { controller } = navigator?.serviceWorker || {};

const uid = useUniqueId();

Expand All @@ -53,6 +56,10 @@ const FileItemMenu = ({ fileData, onClickDelete }: FileItemMenuProps) => {
),
action: () => {
if (fileData.path?.includes('/file-decrypt/')) {
if (!controller) {
return;
}

controller?.postMessage({
type: 'attachment-download',
url: fileData.path,
Expand All @@ -68,6 +75,7 @@ const FileItemMenu = ({ fileData, onClickDelete }: FileItemMenuProps) => {
URL.revokeObjectURL(fileData.url);
}
},
disabled: !canDownloadFile,
},
...(isDeletionAllowed &&
onClickDelete && {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "Rocket.Chat",
"license": "MIT",
"dependencies": {
"@rocket.chat/apps-engine": "1.43.0",
"@rocket.chat/apps-engine": "1.43.1",
"@rocket.chat/core-services": "workspace:^",
"@rocket.chat/core-typings": "workspace:^",
"@rocket.chat/emitter": "~0.31.25",
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
"@rocket.chat/agenda": "workspace:^",
"@rocket.chat/api-client": "workspace:^",
"@rocket.chat/apps": "workspace:^",
"@rocket.chat/apps-engine": "1.43.0",
"@rocket.chat/apps-engine": "1.43.1",
"@rocket.chat/base64": "workspace:^",
"@rocket.chat/cas-validate": "workspace:^",
"@rocket.chat/core-services": "workspace:^",
Expand Down
12 changes: 0 additions & 12 deletions apps/meteor/tests/mocks/mockDate.ts

This file was deleted.

2 changes: 1 addition & 1 deletion ee/apps/ddp-streamer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"author": "Rocket.Chat",
"dependencies": {
"@rocket.chat/apps-engine": "1.43.0",
"@rocket.chat/apps-engine": "1.43.1",
"@rocket.chat/core-services": "workspace:^",
"@rocket.chat/core-typings": "workspace:^",
"@rocket.chat/emitter": "~0.31.25",
Expand Down
Loading

0 comments on commit 721908c

Please sign in to comment.