Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/proud-dingos-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': major
---

Removes the setting `API_Use_REST_For_DDP_Calls`. Turning this on meant websocket was only used for realtime data/events, and any other meteor method calls goes over method.call endpoint. For microservice deployments, this had to be turned on. Now method calls will always happen over http endpoints.
2 changes: 0 additions & 2 deletions apps/meteor/app/ui-master/server/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ window.addEventListener('load', function() {

${process.env.DISABLE_ANIMATION ? 'window.DISABLE_ANIMATION = true;\n' : ''}

${settings.get('API_Use_REST_For_DDP_Calls') ? 'window.USE_REST_FOR_DDP_CALLS = true;\n' : ''}
${settings.get('ECDH_Enabled') ? 'window.ECDH_Enabled = true;\n' : ''}
// Custom_Script_Logged_Out
window.addEventListener('Custom_Script_Logged_Out', function() {
Expand Down Expand Up @@ -54,7 +53,6 @@ window.addEventListener('load', function() {

settings.watchMultiple(
[
'API_Use_REST_For_DDP_Calls',
'Custom_Script_Logged_Out',
'Custom_Script_Logged_In',
'Custom_Script_On_Logout',
Expand Down
4 changes: 1 addition & 3 deletions apps/meteor/client/meteorOverrides/ddpOverREST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,4 @@ const withDDPOverREST = (_send: (this: Meteor.IMeteorConnection, message: Meteor
};
};

if (window.USE_REST_FOR_DDP_CALLS) {
Meteor.connection._send = withDDPOverREST(Meteor.connection._send);
}
Meteor.connection._send = withDDPOverREST(Meteor.connection._send);
1 change: 0 additions & 1 deletion apps/meteor/definition/externals/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ declare global {
lastMessageWindow?: Record<string, unknown>;
lastMessageWindowHistory?: Record<string, unknown>;
favico?: any;
USE_REST_FOR_DDP_CALLS?: boolean;
ECDH_Enabled?: boolean;
__meteor_runtime_config__: {
ROOT_URL_PATH_PREFIX: string;
Expand Down
5 changes: 0 additions & 5 deletions apps/meteor/server/settings/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ export const createGeneralSettings = () =>
enableQuery: { _id: 'API_Enable_CORS', value: true },
});

await this.add('API_Use_REST_For_DDP_Calls', true, {
type: 'boolean',
public: true,
});

// Should enforce the permission on next Major and remove this setting
await this.add('API_Apply_permission_view-outside-room_on_users-list', false, {
type: 'boolean',
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/server/startup/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ import './v316';
import './v317';
import './v318';
import './v319';
import './v320';

export * from './xrun';
10 changes: 10 additions & 0 deletions apps/meteor/server/startup/migrations/v320.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Settings } from '@rocket.chat/models';

import { addMigration } from '../../lib/migrations';

addMigration({
version: 320,
async up() {
await Settings.deleteOne({ _id: 'API_Use_REST_For_DDP_Calls' });
},
});
133 changes: 1 addition & 132 deletions apps/meteor/tests/e2e/presence.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { DEFAULT_USER_CREDENTIALS, IS_EE } from './config/constants';
import { Users } from './fixtures/userStates';
import { DEFAULT_USER_CREDENTIALS } from './config/constants';
import { Registration } from './page-objects';
import { setSettingValueById } from './utils/setSettingValueById';
import { test, expect } from './utils/test';

test.describe.serial('Presence', () => {
Expand All @@ -13,14 +11,6 @@ test.describe.serial('Presence', () => {
await page.goto('/home');
});

test.beforeAll(async ({ api }) => {
await expect((await setSettingValueById(api, 'API_Use_REST_For_DDP_Calls', true)).status()).toBe(200);
});

test.afterAll(async ({ api }) => {
await expect((await setSettingValueById(api, 'API_Use_REST_For_DDP_Calls', true)).status()).toBe(200);
});

test.describe('Login using default settings', () => {
test('expect user to be online after log in', async ({ page }) => {
await poRegistration.username.type('user1');
Expand All @@ -30,125 +20,4 @@ test.describe.serial('Presence', () => {
await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--online')).toBeVisible();
});
});

test.describe('Login using with "Methods by REST" disabled', () => {
test.skip(IS_EE, `Micro services don't support turning this setting off`);

test.beforeAll(async ({ api }) => {
await expect((await setSettingValueById(api, 'API_Use_REST_For_DDP_Calls', false)).status()).toBe(200);
});

test('expect user to be online after log in', async ({ page }) => {
await poRegistration.username.type('user1');
await poRegistration.inputPassword.type(DEFAULT_USER_CREDENTIALS.password);
await poRegistration.btnLogin.click();

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--online')).toBeVisible();
});
});

// This test is supposed to be ran locally because it is too slow.
// It is also a workaround until we find a better way to test this.
test.describe.skip('Calendar appointment automatic status', () => {
test.describe.configure({ timeout: 1000 * 60 * 10 });
test.use({ storageState: Users.admin.state });

test.beforeAll(async ({ api }) => {
await setSettingValueById(api, 'Calendar_BusyStatus_Enabled', true);
});

test.afterAll(async ({ api }) => {
await setSettingValueById(api, 'Calendar_BusyStatus_Enabled', false);
});

test('Should change user status to busy when there is an appointment', async ({ page, api }) => {
await page.goto('/home');

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--online')).toBeVisible();
expect(
(
await api.post('/calendar-events.create', {
startTime: new Date(new Date().getTime() + 1000 * 60 * 2).toISOString(),
endTime: new Date(new Date().getTime() + 1000 * 60 * 3).toISOString(),
subject: 'Test appointment',
description: 'Test appointment description',
meetingUrl: 'https://rocket.chat/',
})
).status(),
).toBe(200);

await test.step('Should change status to busy', async () => {
// wait 2 minutes to ensure the status is changed
await page.waitForTimeout(1000 * 60 * 2);

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--busy')).toBeVisible();
});

await test.step('Should revert status to online', async () => {
// wait 2 minutes to ensure the status is changed
await page.waitForTimeout(1000 * 60);

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--online')).toBeVisible();
});
});

test('Should not change status to busy if the event is deleted', async ({ page, api }) => {
await page.goto('/home');

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--online')).toBeVisible();

const apiResponse = await api.post('/calendar-events.create', {
startTime: new Date(new Date().getTime() + 1000 * 60 * 2).toISOString(),
endTime: new Date(new Date().getTime() + 1000 * 60 * 3).toISOString(),
subject: 'Test appointment',
description: 'Test appointment description',
meetingUrl: 'https://rocket.chat/',
});

expect(apiResponse.status()).toBe(200);

const eventId = (await apiResponse.json()).id;

expect((await api.post('/calendar-events.delete', { eventId })).status()).toBe(200);

await page.waitForTimeout(1000 * 60 * 2);

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--online')).toBeVisible();
});

test('Should update status to busy when the event is updated', async ({ page, api }) => {
await page.goto('/home');

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--online')).toBeVisible();

const apiResponse = await api.post('/calendar-events.create', {
startTime: new Date(new Date().getTime() + 1000 * 60 * 50).toISOString(),
endTime: new Date(new Date().getTime() + 1000 * 60 * 55).toISOString(),
subject: 'Test appointment',
description: 'Test appointment description',
meetingUrl: 'https://rocket.chat/',
});

expect(apiResponse.status()).toBe(200);

const eventId = (await apiResponse.json()).id;

expect(
(
await api.post('/calendar-events.update', {
eventId,
startTime: new Date(new Date().getTime() + 1000 * 60 * 2).toISOString(),
subject: 'Test appointment updated',
description: 'Test appointment description updated',
meetingUrl: 'https://rocket.chat/updated',
})
).status(),
).toBe(200);

// wait 2 minutes to ensure the status is changed
await page.waitForTimeout(1000 * 60 * 2);

await expect(page.getByRole('button', { name: 'User menu' }).locator('.rcx-status-bullet--busy')).toBeVisible();
});
});
});
1 change: 0 additions & 1 deletion packages/i18n/src/locales/ar.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"API_Tokenpass_URL_Description": "مثال: `https://domain.com` (باستثناء الشرطة المائلة اللاحقة)",
"API_Upper_Count_Limit": "الحد الأقصى لكمية السجلات",
"API_Upper_Count_Limit_Description": "ما أقصى حد لعدد السجلات التي يتعين على واجهة برمجة تطبيقات REST إرجاعها (عندما لا تكون غير محدودة)؟",
"API_Use_REST_For_DDP_Calls": "استخدم REST بدلاً من websocket لمكالمات Meteor",
"API_User_Limit": "حد المستخدم لإضافة جميع المستخدمين إلى Channel",
"API_Wordpress_URL": "عنوان URL لـ WordPress",
"APIs": "واجهات برمجة التطبيقات",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/ca.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"API_Tokenpass_URL_Description": "Exemple: `https://domain.com` (excloent la barra inclinada final)",
"API_Upper_Count_Limit": "Quantitat màxima de registre",
"API_Upper_Count_Limit_Description": "Quin és el nombre màxim de registres que la API REST pot retornar (si no és il·limitat)?",
"API_Use_REST_For_DDP_Calls": "Utilitza REST en lloc de websocket per a les trucades de Meteor",
"API_User_Limit": "Límit d'usuari per afegir tots els usuaris a Channel",
"API_Wordpress_URL": "URL de WordPress",
"APIs": "APIs",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/cs.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"API_Tokenpass_URL_Description": "Například: `https://domain.com` (bez koncového lomítka)",
"API_Upper_Count_Limit": "Maximální počet",
"API_Upper_Count_Limit_Description": "Kolik nejvíce záznamů smí REST API vrátit (pokud není limitovaná)",
"API_Use_REST_For_DDP_Calls": "Použít místo websocketů REST",
"API_User_Limit": "Maximální počet uživatelů přidaných do místnosti",
"API_Wordpress_URL": "WordPress URL",
"APIs": "API",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/da.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"API_Tokenpass_URL_Description": "Eksempel: `https://domain.com` (ingen efterfølgende skråstreg)",
"API_Upper_Count_Limit": "Maks. antal resultater",
"API_Upper_Count_Limit_Description": "Hvad er det maksimale antal poster, som REST API skal returnere (når det ikke er ubegrænset)?",
"API_Use_REST_For_DDP_Calls": "Brug REST i stedet for websocket til Meteor-kald",
"API_User_Limit": "Brugergrænse for at føje alle brugere til en kanal",
"API_Wordpress_URL": "WordPress-url",
"APIs": "API'er",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/de.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"API_Tokenpass_URL_Description": "Beispiel: `https://domain.com` (ohne Schrägstrich am Ende)",
"API_Upper_Count_Limit": "Maximales Limit",
"API_Upper_Count_Limit_Description": "Max. Anzahl an Einträgen, die das REST API zurückliefen soll (sofern nicht weiter eingeschränkt)",
"API_Use_REST_For_DDP_Calls": "REST anstatt Websocket für Meteor-Aufrufe verwenden",
"API_User_Limit": "Limit für das Hinzufügen aller Benutzer zu einem Channel",
"API_Wordpress_URL": "WordPress-URL",
"APIs": "APIs",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"API_Tokenpass_URL_Description": "Example: `https://domain.com` (excluding trailing slash)",
"API_Upper_Count_Limit": "Max Record Amount",
"API_Upper_Count_Limit_Description": "What is the maximum number of records the REST API should return (when not unlimited)?",
"API_Use_REST_For_DDP_Calls": "Use REST instead of websocket for Meteor calls",
"API_User_Limit": "User Limit for Adding All Users to Channel",
"API_Wordpress_URL": "WordPress URL",
"APIs": "APIs",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/es.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"API_Tokenpass_URL_Description": "Ejemplo: `https://domain.com` (sin barra oblicua final)",
"API_Upper_Count_Limit": "Cantidad máxima de registros",
"API_Upper_Count_Limit_Description": "¿Cuál es el número máximo de registros que debe devolver la API REST (cuando no sea ilimitado)?",
"API_Use_REST_For_DDP_Calls": "Usar REST en lugar de WebSocket para las llamadas de Meteor",
"API_User_Limit": "Límite de usuarios al añadir todos los usuarios a Channel",
"API_Wordpress_URL": "URL de WordPress",
"APIs": "APIs",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/fi.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"API_Tokenpass_URL_Description": "Esimerkki: `https://domain.com` (ilman kenoviivaa lopussa)",
"API_Upper_Count_Limit": "Tietueiden enimmäismäärä",
"API_Upper_Count_Limit_Description": "Mikä on enimmäismäärä tietueita, jotka REST APIn pitäisi palauttaa (jos ei rajoittamaton)?",
"API_Use_REST_For_DDP_Calls": "Käytä RESTiä Meteor-puheluihin websocketin sijasta",
"API_User_Limit": "Käyttäjärajoitus kaikkien käyttäjien lisäämiselle kanavalle",
"API_Wordpress_URL": "WordPress-URL-osoite",
"APIs": "APIt",
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/src/locales/fr.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"API_Tokenpass_URL_Description": "Exemple : https://domaine.com (sans le signe / à la fin)",
"API_Upper_Count_Limit": "Nombre maximal d'enregistrements",
"API_Upper_Count_Limit_Description": "Quel est le nombre maximal d'enregistrements que l'API REST doit retourner (s'il n'est pas illimité) ?",
"API_Use_REST_For_DDP_Calls": "Utiliser REST au lieu de websocket pour les appels Meteor",
"API_User_Limit": "Limite d'utilisateurs pour ajouter tous les utilisateurs au canal",
"API_Wordpress_URL": "URL WordPress",
"APIs": "API",
Expand Down
Loading
Loading