Skip to content

Commit

Permalink
Merge branch 'release-6.10.0' into regression/user-panel-memory
Browse files Browse the repository at this point in the history
  • Loading branch information
rique223 authored Jul 1, 2024
2 parents 49b15bb + 7ee9ca1 commit edbf5e9
Show file tree
Hide file tree
Showing 80 changed files with 610 additions and 96 deletions.
5 changes: 5 additions & 0 deletions .changeset/bump-patch-1719620501814.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Bump @rocket.chat/meteor version.
1 change: 1 addition & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"brown-lobsters-join",
"bump-patch-1719268507210",
"bump-patch-1719375980788",
"bump-patch-1719620501814",
"chilly-toys-hunt",
"clean-moose-cover",
"cuddly-cycles-nail",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
rc-docker-tag-alpine: '${{ steps.docker.outputs.gh-docker-tag }}.alpine'
node-version: ${{ steps.var.outputs.node-version }}
# this is 100% intentional, secrets are not available for forks, so ee-tests will always fail
# to avoid this, we are using a dummy license, expiring at 2024-06-30
enterprise-license: WMa5i+/t/LZbYOj8u3XUkivRhWBtWO6ycUjaZoVAw2DxMfdyBIAa2gMMI4x7Z2BrTZIZhFEImfOxcXcgD0QbXHGBJaMI+eYG+eofnVWi2VA7RWbpvWTULgPFgyJ4UEFeCOzVjcBLTQbmMSam3u0RlekWJkfAO0KnmLtsaEYNNA2rz1U+CLI/CdNGfdqrBu5PZZbGkH0KEzyIZMaykOjzvX+C6vd7fRxh23HecwhkBbqE8eQsCBt2ad0qC4MoVXsDaSOmSzGW+aXjuXt/9zjvrLlsmWQTSlkrEHdNkdywm0UkGxqz3+CP99n0WggUBioUiChjMuNMoceWvDvmxYP9Ml2NpYU7SnfhjmMFyXOah8ofzv8w509Y7XODvQBz+iB4Co9YnF3vT96HDDQyAV5t4jATE+0t37EAXmwjTi3qqyP7DLGK/revl+mlcwJ5kS4zZBsm1E4519FkXQOZSyWRnPdjqvh4mCLqoispZ49wKvklDvjPxCSP9us6cVXLDg7NTJr/4pfxLPOkvv7qCgugDvlDx17bXpQFPSDxmpw66FLzvb5Id0dkWjOzrRYSXb0bFWoUQjtHFzmcpFkyVhOKrQ9zA9+Zm7vXmU9Y2l2dK79EloOuHMSYAqsPEag8GMW6vI/cT4iIjHGGDePKnD0HblvTEKzql11cfT/abf2IiaY=
# to avoid this, we are using a dummy license, expiring at 2025-06-31
enterprise-license: X/XumwIkgwQuld0alWKt37lVA90XjKOrfiMvMZ0/RtqsMtrdL9GoAk+4jXnaY1b2ePoG7XSzGhuxEDxFKIWJK3hIKGNTvrd980LgH5sM5+1T4P42ivSpd8UZi0bwjJkCFLIu9RozzYwslGG0IehMxe0S6VjcO0UYlUJtbMCBHuR2WmTAmO6YVU3ln+pZCbrPFaTPSS1RovhKaNCNkZwIx/CLWW8UTXUuFV/ML4PbKKVoa5nvvJwPeatgL7UCnlSD90lfCiiuikpzj/Y/JLkIL6velFbwNxsrxg9iRJ2k0sKheMMSmlTiGzSvZUm+na5WQq91aKGncih+DmaEZA7QGrjp4eoA0dqTk6OmItsy0fHmQhvZIOKNMeO7vNQiLbaSV6rqibrzu7WPpeIvsvL57T1h37USoCSB6+jDqkzdfoqIpz8BxTiJDj1d8xGPJFVrgxoqQqkj9qIP/gCaEz5DF39QFv5sovk4yK2O8fEQYod2d14V9yECYl4szZPMk1IBfCAC2w7czWGHHFonhL+CQGT403y5wmDmnsnjlCqMKF72odqfTPTI8XnCvJDriPMWohnQEAGtTTyciAhNokx/mjAVJ4NeZPcsbm4BjhvJvnjxx/BhYhBBTNWPaCSZzocfrGUj9Z+ZA7BEz+xAFQyGDx3xRzqIXfT0G7w8fvgYJMU=
steps:
- uses: Bhacaz/checkout-files@v2
with:
Expand Down
32 changes: 32 additions & 0 deletions apps/meteor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# @rocket.chat/meteor

## 6.10.0-rc.3

### Patch Changes

- Bump @rocket.chat/meteor version.

- <details><summary>Updated dependencies []:</summary>

- @rocket.chat/core-typings@6.10.0-rc.3
- @rocket.chat/rest-typings@6.10.0-rc.3
- @rocket.chat/api-client@0.2.0-rc.3
- @rocket.chat/license@0.2.0-rc.3
- @rocket.chat/omnichannel-services@0.2.0-rc.3
- @rocket.chat/pdf-worker@0.1.0-rc.3
- @rocket.chat/presence@0.2.0-rc.3
- @rocket.chat/apps@0.1.0-rc.3
- @rocket.chat/core-services@0.4.0-rc.3
- @rocket.chat/cron@0.1.0-rc.3
- @rocket.chat/fuselage-ui-kit@8.0.0-rc.3
- @rocket.chat/gazzodown@8.0.0-rc.3
- @rocket.chat/model-typings@0.5.0-rc.3
- @rocket.chat/ui-contexts@8.0.0-rc.3
- @rocket.chat/server-cloud-communication@0.0.2
- @rocket.chat/models@0.1.0-rc.3
- @rocket.chat/ui-theming@0.2.0-rc.0
- @rocket.chat/ui-avatar@4.0.0-rc.3
- @rocket.chat/ui-client@8.0.0-rc.3
- @rocket.chat/ui-video-conf@8.0.0-rc.3
- @rocket.chat/web-ui-registration@8.0.0-rc.3
- @rocket.chat/instance-status@0.1.0-rc.3
</details>

## 6.10.0-rc.2

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions apps/meteor/app/lib/server/functions/notifications/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Meteor.startup(() => {
});
});

async function getEmailContent({ message, user, room }) {
export async function getEmailContent({ message, user, room }) {
const lng = (user && user.language) || settings.get('Language') || 'en';

const roomName = escapeHTML(`#${await roomCoordinator.getRoomName(room.t, room)}`);
Expand All @@ -35,17 +35,17 @@ async function getEmailContent({ message, user, room }) {
lng,
});

if (message.t === 'e2e' && !message.file) {
return settings.get('Email_notification_show_message') ? i18n.t('Encrypted_message_preview_unavailable', { lng }) : header;
}

if (message.msg !== '') {
if (!settings.get('Email_notification_show_message')) {
return header;
}

let messageContent = escapeHTML(message.msg);

if (message.t === 'e2e') {
messageContent = i18n.t('Encrypted_message_preview_unavailable', { lng });
}

message = await callbacks.run('renderMessage', message);
if (message.tokens && message.tokens.length > 0) {
message.tokens.forEach((token) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/lib/server/methods/updateMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { hasPermissionAsync } from '../../../authorization/server/functions/hasP
import { settings } from '../../../settings/server';
import { updateMessage } from '../functions/updateMessage';

const allowedEditedFields = ['tshow', 'alias', 'attachments', 'avatar', 'emoji', 'msg', 'customFields'];
const allowedEditedFields = ['tshow', 'alias', 'attachments', 'avatar', 'emoji', 'msg', 'customFields', 'content'];

export async function executeUpdateMessage(uid: IUser['_id'], message: AtLeast<IMessage, '_id' | 'rid' | 'msg'>, previewUrls?: string[]) {
const originalMessage = await Messages.findOneById(message._id);
Expand Down
61 changes: 38 additions & 23 deletions apps/meteor/app/statistics/server/lib/getAppsStatistics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Apps } from '@rocket.chat/apps';
import { AppStatus, AppStatusUtils } from '@rocket.chat/apps-engine/definition/AppStatus';
import mem from 'mem';

import { SystemLogger } from '../../../../server/lib/logger/system';
import { Info } from '../../../utils/rocketchat.info';

export type AppsStatistics = {
Expand All @@ -10,7 +12,7 @@ export type AppsStatistics = {
totalFailed: number | false;
};

export async function getAppsStatistics(): Promise<AppsStatistics> {
async function _getAppsStatistics(): Promise<AppsStatistics> {
if (!Apps.self?.isInitialized()) {
return {
engineVersion: Info.marketplaceApiVersion,
Expand All @@ -20,32 +22,45 @@ export async function getAppsStatistics(): Promise<AppsStatistics> {
};
}

const apps = await Apps.getManager().get();
try {
const apps = await Apps.getManager().get();

let totalInstalled = 0;
let totalActive = 0;
let totalFailed = 0;
let totalInstalled = 0;
let totalActive = 0;
let totalFailed = 0;

await Promise.all(
apps.map(async (app) => {
totalInstalled++;
await Promise.all(
apps.map(async (app) => {
totalInstalled++;

const status = await app.getStatus();
const status = await app.getStatus();

if (status === AppStatus.MANUALLY_DISABLED) {
totalFailed++;
}
if (status === AppStatus.MANUALLY_DISABLED) {
totalFailed++;
}

if (AppStatusUtils.isEnabled(status)) {
totalActive++;
}
}),
);
if (AppStatusUtils.isEnabled(status)) {
totalActive++;
}
}),
);

return {
engineVersion: Info.marketplaceApiVersion,
totalInstalled,
totalActive,
totalFailed,
};
return {
engineVersion: Info.marketplaceApiVersion,
totalInstalled,
totalActive,
totalFailed,
};
} catch (err: unknown) {
SystemLogger.error({ msg: 'Exception while getting Apps statistics', err });
return {
engineVersion: Info.marketplaceApiVersion,
totalInstalled: false,
totalActive: false,
totalFailed: false,
};
}
}

// since this function is called every 5s by `setPrometheusData` we're memoizing the result since the result won't change that often
export const getAppsStatistics = mem(_getAppsStatistics, { maxAge: 60000 });
2 changes: 1 addition & 1 deletion apps/meteor/app/utils/rocketchat.info
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "6.10.0-rc.2"
"version": "6.10.0-rc.3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const processMessageEditing = async (
return false;
}

if (!message.msg && !message.attachments?.length) {
if (!message.msg && !message.attachments?.length && !message.content) {
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions apps/meteor/client/lib/chats/flows/sendMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ const process = async (chat: ChatAPI, message: IMessage, previewUrls?: string[],
return;
}

if (await processMessageEditing(chat, message, previewUrls)) {
return;
}

if (isSlashCommandAllowed && (await processSlashCommand(chat, message))) {
return;
}

message = (await onClientBeforeSendMessage(message)) as IMessage;

if (await processMessageEditing(chat, message, previewUrls)) {
return;
}

await sdk.call('sendMessage', message, previewUrls);
};

Expand Down
13 changes: 0 additions & 13 deletions apps/meteor/client/lib/chats/flows/uploadFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@ import { imperativeModal } from '../../imperativeModal';
import { prependReplies } from '../../utils/prependReplies';
import type { ChatAPI } from '../ChatAPI';

if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/enc.js', {
scope: '/',
})
.then((reg) => {
if (reg.active) console.log('service worker installed');
})
.catch((err) => {
console.log(`registration failed: ${err}`);
});
}

const getHeightAndWidthFromDataUrl = (dataURL: string): Promise<{ height: number; width: number }> => {
return new Promise((resolve) => {
const img = new Image();
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/client/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './serviceWorker';
import './startup/accounts';

import { FlowRouter } from 'meteor/kadira:flow-router';
Expand Down
40 changes: 40 additions & 0 deletions apps/meteor/client/serviceWorker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const KEY = 'sw_last_reload';
const RELOAD_WINDOW = 1000 * 10;

function reload() {
const lastReload = localStorage.getItem(KEY);

if (lastReload) {
const last = Date.parse(lastReload);

if (!isNaN(last)) {
const elapsed = Date.now() - last;

if (elapsed < RELOAD_WINDOW) {
return;
}
}
}

localStorage.setItem(KEY, new Date().toISOString());
console.log('service worker: reloading to activate');
window.location.reload();
}

if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/enc.js', {
scope: '/',
})
.then((reg) => {
if (reg.active) {
console.log('service worker: installed');
if (!navigator.serviceWorker.controller) {
reload();
}
}
})
.catch((err) => {
console.log(`registration failed: ${err}`);
});
}
13 changes: 13 additions & 0 deletions apps/meteor/ee/server/services/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# rocketchat-services

## 1.2.0-rc.3

### Patch Changes

- <details><summary>Updated dependencies []:</summary>

- @rocket.chat/core-typings@6.10.0-rc.3
- @rocket.chat/rest-typings@6.10.0-rc.3
- @rocket.chat/core-services@0.4.0-rc.3
- @rocket.chat/model-typings@0.5.0-rc.3
- @rocket.chat/models@0.1.0-rc.3
</details>

## 1.2.0-rc.2

### Patch Changes
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
@@ -1,7 +1,7 @@
{
"name": "rocketchat-services",
"private": true,
"version": "1.2.0-rc.2",
"version": "1.2.0-rc.3",
"description": "Rocket.Chat Authorization service",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rocket.chat/meteor",
"description": "The Ultimate Open Source WebChat Platform",
"version": "6.10.0-rc.2",
"version": "6.10.0-rc.3",
"private": true,
"author": {
"name": "Rocket.Chat",
Expand Down
8 changes: 8 additions & 0 deletions apps/meteor/public/enc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
self.addEventListener('install', function(event) {
event.waitUntil(self.skipWaiting()); // Activate worker immediately
});

self.addEventListener('activate', function(event) {
event.waitUntil(self.clients.claim()); // Become available to all pages
});

function base64Decode(string) {
string = atob(string);
const length = string.length,
Expand Down
Loading

0 comments on commit edbf5e9

Please sign in to comment.