From 5ddb8c3edd6bf3518d60847706e612b10f7612ce Mon Sep 17 00:00:00 2001 From: rocketchat-github-ci Date: Mon, 29 Jul 2024 21:32:32 +0000 Subject: [PATCH 1/4] Bump 6.10.2 --- .changeset/bump-patch-1722288752329.md | 5 +++++ yarn.lock | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .changeset/bump-patch-1722288752329.md diff --git a/.changeset/bump-patch-1722288752329.md b/.changeset/bump-patch-1722288752329.md new file mode 100644 index 000000000000..e1eaa7980afb --- /dev/null +++ b/.changeset/bump-patch-1722288752329.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +Bump @rocket.chat/meteor version. diff --git a/yarn.lock b/yarn.lock index 0db2fc4c65d8..f94e9b8e7add 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8967,10 +8967,10 @@ __metadata: "@rocket.chat/icons": "*" "@rocket.chat/prettier-config": "*" "@rocket.chat/styled": "*" - "@rocket.chat/ui-avatar": 4.0.0 - "@rocket.chat/ui-contexts": 8.0.0 + "@rocket.chat/ui-avatar": 4.0.1 + "@rocket.chat/ui-contexts": 8.0.1 "@rocket.chat/ui-kit": 0.35.0 - "@rocket.chat/ui-video-conf": 8.0.0 + "@rocket.chat/ui-video-conf": 8.0.1 "@tanstack/react-query": "*" react: "*" react-dom: "*" @@ -9059,8 +9059,8 @@ __metadata: "@rocket.chat/fuselage-tokens": "*" "@rocket.chat/message-parser": 0.31.29 "@rocket.chat/styled": "*" - "@rocket.chat/ui-client": 8.0.0 - "@rocket.chat/ui-contexts": 8.0.0 + "@rocket.chat/ui-client": 8.0.1 + "@rocket.chat/ui-contexts": 8.0.1 katex: "*" react: "*" languageName: unknown @@ -10278,7 +10278,7 @@ __metadata: typescript: ~5.3.3 peerDependencies: "@rocket.chat/fuselage": "*" - "@rocket.chat/ui-contexts": 8.0.0 + "@rocket.chat/ui-contexts": 8.0.1 react: ~17.0.2 languageName: unknown linkType: soft @@ -10331,7 +10331,7 @@ __metadata: "@rocket.chat/fuselage": "*" "@rocket.chat/fuselage-hooks": "*" "@rocket.chat/icons": "*" - "@rocket.chat/ui-contexts": 8.0.0 + "@rocket.chat/ui-contexts": 8.0.1 react: ~17.0.2 languageName: unknown linkType: soft @@ -10507,8 +10507,8 @@ __metadata: "@rocket.chat/fuselage-hooks": "*" "@rocket.chat/icons": "*" "@rocket.chat/styled": "*" - "@rocket.chat/ui-avatar": 4.0.0 - "@rocket.chat/ui-contexts": 8.0.0 + "@rocket.chat/ui-avatar": 4.0.1 + "@rocket.chat/ui-contexts": 8.0.1 react: ^17.0.2 react-dom: ^17.0.2 languageName: unknown @@ -10598,7 +10598,7 @@ __metadata: peerDependencies: "@rocket.chat/layout": "*" "@rocket.chat/tools": 0.2.1 - "@rocket.chat/ui-contexts": 8.0.0 + "@rocket.chat/ui-contexts": 8.0.1 "@tanstack/react-query": "*" react: "*" react-hook-form: "*" From e1b4c28dde5f39a72d06f1310742ff42ce52c4ba Mon Sep 17 00:00:00 2001 From: "dionisio-bot[bot]" <117394943+dionisio-bot[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:53:15 -0300 Subject: [PATCH 2/4] test: Remove mockDate and fix unit tests (#32947) (#32949) Co-authored-by: gabriellsh <40830821+gabriellsh@users.noreply.github.com> --- .../InfoPanel/RetentionPolicyCallout.spec.tsx | 7 ++++--- .../hooks/usePruneWarningMessage.spec.ts | 18 ++++-------------- .../room/body/RetentionPolicyWarning.spec.tsx | 7 ++++--- apps/meteor/tests/mocks/mockDate.ts | 12 ------------ 4 files changed, 12 insertions(+), 32 deletions(-) delete mode 100644 apps/meteor/tests/mocks/mockDate.ts diff --git a/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx b/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx index 9a2e7eac4c45..fb97b0132f85 100644 --- a/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx +++ b/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx @@ -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(, { 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(, { wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000, advancedPrecisionCron: '* * * 12 *', advancedPrecision: true }), diff --git a/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts b/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts index 1ea3825c61ec..bb602cb81a3a 100644 --- a/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts +++ b/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts @@ -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(); @@ -22,10 +21,13 @@ const getRetentionRoomProps = (props: Partial { + 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({ @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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({ @@ -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({ @@ -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(), }); @@ -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(), }); @@ -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(), @@ -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(), diff --git a/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx b/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx index 28a6eca3b283..a6c49c5537de 100644 --- a/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx +++ b/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx @@ -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(, { 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(, { wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000, advancedPrecisionCron: '* * * 12 *', advancedPrecision: true }), diff --git a/apps/meteor/tests/mocks/mockDate.ts b/apps/meteor/tests/mocks/mockDate.ts deleted file mode 100644 index 6591dfdf7b1b..000000000000 --- a/apps/meteor/tests/mocks/mockDate.ts +++ /dev/null @@ -1,12 +0,0 @@ -// you must use jest.useFakeTimers for this to work. -export const setDate = (minutes = 1, hours = 0, date = 1) => { - // June 12, 2024, 12:00 AM - const fakeDate = new Date(); - fakeDate.setFullYear(2024); - fakeDate.setMonth(5); - fakeDate.setDate(date); - fakeDate.setHours(hours); - fakeDate.setMinutes(minutes); - fakeDate.setSeconds(0); - jest.setSystemTime(fakeDate); -}; From ca6a9d8de80a187c8f9b3ba2809511e35e169de9 Mon Sep 17 00:00:00 2001 From: Douglas Gubert Date: Wed, 31 Jul 2024 15:55:52 -0300 Subject: [PATCH 3/4] fix: Apps-Engine patch (#32935) --- .changeset/cold-chairs-wash.md | 13 +++++++++++ .changeset/early-trains-bow.md | 13 +++++++++++ .changeset/fair-wasps-switch.md | 13 +++++++++++ .changeset/soft-toys-invent.md | 13 +++++++++++ apps/meteor/ee/server/services/package.json | 2 +- apps/meteor/package.json | 2 +- ee/apps/ddp-streamer/package.json | 2 +- ee/packages/presence/package.json | 2 +- packages/apps/package.json | 2 +- packages/core-services/package.json | 2 +- packages/core-typings/package.json | 2 +- packages/fuselage-ui-kit/package.json | 2 +- packages/rest-typings/package.json | 2 +- yarn.lock | 26 ++++++++++----------- 14 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 .changeset/cold-chairs-wash.md create mode 100644 .changeset/early-trains-bow.md create mode 100644 .changeset/fair-wasps-switch.md create mode 100644 .changeset/soft-toys-invent.md diff --git a/.changeset/cold-chairs-wash.md b/.changeset/cold-chairs-wash.md new file mode 100644 index 000000000000..89087deaee46 --- /dev/null +++ b/.changeset/cold-chairs-wash.md @@ -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 diff --git a/.changeset/early-trains-bow.md b/.changeset/early-trains-bow.md new file mode 100644 index 000000000000..035eb4506188 --- /dev/null +++ b/.changeset/early-trains-bow.md @@ -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 diff --git a/.changeset/fair-wasps-switch.md b/.changeset/fair-wasps-switch.md new file mode 100644 index 000000000000..34ae58397f9a --- /dev/null +++ b/.changeset/fair-wasps-switch.md @@ -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 diff --git a/.changeset/soft-toys-invent.md b/.changeset/soft-toys-invent.md new file mode 100644 index 000000000000..6994ff349526 --- /dev/null +++ b/.changeset/soft-toys-invent.md @@ -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 diff --git a/apps/meteor/ee/server/services/package.json b/apps/meteor/ee/server/services/package.json index 735f155feaa5..c3f81b02e4b9 100644 --- a/apps/meteor/ee/server/services/package.json +++ b/apps/meteor/ee/server/services/package.json @@ -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", diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 4c2ad51c5f14..4007f12f2230 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -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:^", diff --git a/ee/apps/ddp-streamer/package.json b/ee/apps/ddp-streamer/package.json index 013609f580d5..914ca3585729 100644 --- a/ee/apps/ddp-streamer/package.json +++ b/ee/apps/ddp-streamer/package.json @@ -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", diff --git a/ee/packages/presence/package.json b/ee/packages/presence/package.json index b3298d31d856..86b9048947b8 100644 --- a/ee/packages/presence/package.json +++ b/ee/packages/presence/package.json @@ -6,7 +6,7 @@ "@babel/core": "~7.22.20", "@babel/preset-env": "~7.22.20", "@babel/preset-typescript": "~7.22.15", - "@rocket.chat/apps-engine": "1.43.0", + "@rocket.chat/apps-engine": "1.43.1", "@rocket.chat/eslint-config": "workspace:^", "@rocket.chat/rest-typings": "workspace:^", "@types/node": "^14.18.63", diff --git a/packages/apps/package.json b/packages/apps/package.json index cae747dc0570..f8c16c8fca6e 100644 --- a/packages/apps/package.json +++ b/packages/apps/package.json @@ -22,7 +22,7 @@ "/dist" ], "dependencies": { - "@rocket.chat/apps-engine": "1.43.0", + "@rocket.chat/apps-engine": "1.43.1", "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/model-typings": "workspace:^" } diff --git a/packages/core-services/package.json b/packages/core-services/package.json index 3c57d3c6f3da..37de150c969c 100644 --- a/packages/core-services/package.json +++ b/packages/core-services/package.json @@ -34,7 +34,7 @@ "extends": "../../package.json" }, "dependencies": { - "@rocket.chat/apps-engine": "1.43.0", + "@rocket.chat/apps-engine": "1.43.1", "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/icons": "^0.36.0", "@rocket.chat/message-parser": "workspace:^", diff --git a/packages/core-typings/package.json b/packages/core-typings/package.json index 3160b2223a5c..149cb50981ad 100644 --- a/packages/core-typings/package.json +++ b/packages/core-typings/package.json @@ -22,7 +22,7 @@ "/dist" ], "dependencies": { - "@rocket.chat/apps-engine": "1.43.0", + "@rocket.chat/apps-engine": "1.43.1", "@rocket.chat/icons": "^0.36.0", "@rocket.chat/message-parser": "workspace:^", "@rocket.chat/ui-kit": "workspace:~" diff --git a/packages/fuselage-ui-kit/package.json b/packages/fuselage-ui-kit/package.json index d340189971ef..9377a9b80f59 100644 --- a/packages/fuselage-ui-kit/package.json +++ b/packages/fuselage-ui-kit/package.json @@ -63,7 +63,7 @@ "@babel/preset-env": "~7.22.20", "@babel/preset-react": "~7.22.15", "@babel/preset-typescript": "~7.22.15", - "@rocket.chat/apps-engine": "1.43.0", + "@rocket.chat/apps-engine": "1.43.1", "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/eslint-config": "workspace:^", "@rocket.chat/fuselage": "^0.54.3", diff --git a/packages/rest-typings/package.json b/packages/rest-typings/package.json index 51a5499ac3d0..dcf862ca0da4 100644 --- a/packages/rest-typings/package.json +++ b/packages/rest-typings/package.json @@ -24,7 +24,7 @@ "/dist" ], "dependencies": { - "@rocket.chat/apps-engine": "1.43.0", + "@rocket.chat/apps-engine": "1.43.1", "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/message-parser": "workspace:^", "@rocket.chat/ui-kit": "workspace:~", diff --git a/yarn.lock b/yarn.lock index f94e9b8e7add..cb488238f2de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8508,9 +8508,9 @@ __metadata: languageName: unknown linkType: soft -"@rocket.chat/apps-engine@npm:1.43.0": - version: 1.43.0 - resolution: "@rocket.chat/apps-engine@npm:1.43.0" +"@rocket.chat/apps-engine@npm:1.43.1": + version: 1.43.1 + resolution: "@rocket.chat/apps-engine@npm:1.43.1" dependencies: "@msgpack/msgpack": 3.0.0-beta2 adm-zip: ^0.5.9 @@ -8526,7 +8526,7 @@ __metadata: uuid: ~8.3.2 peerDependencies: "@rocket.chat/ui-kit": "*" - checksum: d2a4be96fd56bd7790459cbe82d87601ce8cb4e846a8cd5d1cddbc699ff776f3dcd07b3b22a7e74f12e2f1b0361b6c3cf4a415254f1f5d75d537f5c5730ce05e + checksum: 46dc87b92acbfe49ef4669920707cdf3a577e49ce04d3c139bb12e3666a6a1d4a536e7ab9ecf5b64c27dd73bd85fd0ccbb954eb97b55f6926600cf31b2fcb6fe languageName: node linkType: hard @@ -8534,7 +8534,7 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/apps@workspace:packages/apps" dependencies: - "@rocket.chat/apps-engine": 1.43.0 + "@rocket.chat/apps-engine": 1.43.1 "@rocket.chat/core-typings": "workspace:^" "@rocket.chat/model-typings": "workspace:^" "@types/jest": ~29.5.7 @@ -8613,7 +8613,7 @@ __metadata: "@babel/core": ~7.22.20 "@babel/preset-env": ~7.22.20 "@babel/preset-typescript": ~7.22.15 - "@rocket.chat/apps-engine": 1.43.0 + "@rocket.chat/apps-engine": 1.43.1 "@rocket.chat/core-typings": "workspace:^" "@rocket.chat/eslint-config": "workspace:^" "@rocket.chat/icons": ^0.36.0 @@ -8639,7 +8639,7 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/core-typings@workspace:packages/core-typings" dependencies: - "@rocket.chat/apps-engine": 1.43.0 + "@rocket.chat/apps-engine": 1.43.1 "@rocket.chat/eslint-config": "workspace:^" "@rocket.chat/icons": ^0.36.0 "@rocket.chat/message-parser": "workspace:^" @@ -8716,7 +8716,7 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/ddp-streamer@workspace:ee/apps/ddp-streamer" 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 @@ -8912,7 +8912,7 @@ __metadata: "@babel/preset-env": ~7.22.20 "@babel/preset-react": ~7.22.15 "@babel/preset-typescript": ~7.22.15 - "@rocket.chat/apps-engine": 1.43.0 + "@rocket.chat/apps-engine": 1.43.1 "@rocket.chat/core-typings": "workspace:^" "@rocket.chat/eslint-config": "workspace:^" "@rocket.chat/fuselage": ^0.54.3 @@ -9356,7 +9356,7 @@ __metadata: "@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:^" @@ -9994,7 +9994,7 @@ __metadata: "@babel/core": ~7.22.20 "@babel/preset-env": ~7.22.20 "@babel/preset-typescript": ~7.22.15 - "@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/eslint-config": "workspace:^" @@ -10109,7 +10109,7 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/rest-typings@workspace:packages/rest-typings" dependencies: - "@rocket.chat/apps-engine": 1.43.0 + "@rocket.chat/apps-engine": 1.43.1 "@rocket.chat/core-typings": "workspace:^" "@rocket.chat/eslint-config": "workspace:^" "@rocket.chat/message-parser": "workspace:^" @@ -37135,7 +37135,7 @@ __metadata: version: 0.0.0-use.local resolution: "rocketchat-services@workspace:apps/meteor/ee/server/services" 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 From 7d9bb115cd4c360c3684b8825374dd77c85fbd69 Mon Sep 17 00:00:00 2001 From: "dionisio-bot[bot]" <117394943+dionisio-bot[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 17:47:07 -0300 Subject: [PATCH 4/4] fix: Client crashing on firefox private window (#32950) Co-authored-by: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com> Co-authored-by: Diego Sampaio --- .changeset/new-balloons-speak.md | 7 ++++++ .../structure/AttachmentDownloadBase.tsx | 5 ++-- .../hooks/useDownloadFromServiceWorker.ts | 23 ++++++++++++------- .../RoomFiles/components/FileItemMenu.tsx | 22 ++++++++++++------ packages/i18n/src/locales/en.i18n.json | 1 + 5 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 .changeset/new-balloons-speak.md diff --git a/.changeset/new-balloons-speak.md b/.changeset/new-balloons-speak.md new file mode 100644 index 000000000000..cecaabe353ba --- /dev/null +++ b/.changeset/new-balloons-speak.md @@ -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 diff --git a/apps/meteor/client/components/message/content/attachments/structure/AttachmentDownloadBase.tsx b/apps/meteor/client/components/message/content/attachments/structure/AttachmentDownloadBase.tsx index 48c078b9146c..c9adc4533a97 100644 --- a/apps/meteor/client/components/message/content/attachments/structure/AttachmentDownloadBase.tsx +++ b/apps/meteor/client/components/message/content/attachments/structure/AttachmentDownloadBase.tsx @@ -6,18 +6,19 @@ import Action from '../../Action'; type AttachmentDownloadBaseProps = Omit, 'icon'> & { title?: string | undefined; href: string }; -const AttachmentDownloadBase: FC = ({ title, href, ...props }) => { +const AttachmentDownloadBase: FC = ({ title, href, disabled, ...props }) => { const t = useTranslation(); return ( ); diff --git a/apps/meteor/client/hooks/useDownloadFromServiceWorker.ts b/apps/meteor/client/hooks/useDownloadFromServiceWorker.ts index 5ab7f804fec7..199d1507e284 100644 --- a/apps/meteor/client/hooks/useDownloadFromServiceWorker.ts +++ b/apps/meteor/client/hooks/useDownloadFromServiceWorker.ts @@ -7,13 +7,15 @@ import { downloadAs } from '../lib/download'; const ee = new Emitter>(); -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['t'], title?: string) => { ee.once(uid, ({ result }) => { @@ -23,8 +25,13 @@ export const registerDownloadForUid = (uid: string, t: ReturnType { if (!controller) { - controller = navigator.serviceWorker.controller; + controller = navigator?.serviceWorker?.controller; + } + + if (!controller) { + return; } + controller?.postMessage({ type: 'attachment-download', url: href, @@ -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(); diff --git a/apps/meteor/client/views/room/contextualBar/RoomFiles/components/FileItemMenu.tsx b/apps/meteor/client/views/room/contextualBar/RoomFiles/components/FileItemMenu.tsx index 157df8d78027..4fbf2fc477f1 100644 --- a/apps/meteor/client/views/room/contextualBar/RoomFiles/components/FileItemMenu.tsx +++ b/apps/meteor/client/views/room/contextualBar/RoomFiles/components/FileItemMenu.tsx @@ -17,21 +17,24 @@ type FileItemMenuProps = { const ee = new Emitter>(); -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(); @@ -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, @@ -68,6 +75,7 @@ const FileItemMenu = ({ fileData, onClickDelete }: FileItemMenuProps) => { URL.revokeObjectURL(fileData.url); } }, + disabled: !canDownloadFile, }, ...(isDeletionAllowed && onClickDelete && { diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index f9f29f1fcc30..e4d1c611aef6 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -1756,6 +1756,7 @@ "Dont_ask_me_again_list": "Don't ask me again list", "Download": "Download", "Download_Destkop_App": "Download Desktop App", + "Download_Disabled": "Download disabled", "Download_Info": "Download info", "Download_My_Data": "Download My Data (HTML)", "Download_Pending_Avatars": "Download Pending Avatars",