Skip to content

Commit

Permalink
Merge branch 'develop' into fix/login-services-button-props
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Jul 10, 2024
2 parents d1eb771 + 72b8b5e commit bb30b5f
Show file tree
Hide file tree
Showing 61 changed files with 172 additions and 120 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-buttons-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Fixed an issue where FCM actions did not respect environment's proxy settings
30 changes: 29 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,38 @@ jobs:
name: ✅ Tests Done
runs-on: ubuntu-20.04
needs: [checks, test-unit, test-api, test-ui, test-api-ee, test-ui-ee, test-ui-ee-no-watcher]

if: always()
steps:
- name: Test finish aggregation
run: |
if [[ '${{ needs.checks.result }}' != 'success' ]]; then
exit 1
fi
if [[ '${{ needs.test-unit.result }}' != 'success' ]]; then
exit 1
fi
if [[ '${{ needs.test-api.result }}' != 'success' ]]; then
exit 1
fi
if [[ '${{ needs.test-ui.result }}' != 'success' ]]; then
exit 1
fi
if [[ '${{ needs.test-api-ee.result }}' != 'success' ]]; then
exit 1
fi
if [[ '${{ needs.test-ui-ee.result }}' != 'success' ]]; then
exit 1
fi
if [[ '${{ needs.test-ui-ee-no-watcher.result }}' != 'success' ]]; then
exit 1
fi
echo finished
deploy:
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/app/push/server/fcm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { serverFetch as fetch, type ExtendedFetchOptions } from '@rocket.chat/server-fetch';
import EJSON from 'ejson';
import fetch from 'node-fetch';
import type { RequestInit, Response } from 'node-fetch';
import type { Response } from 'node-fetch';

import type { PendingPushNotification } from './definition';
import { logger } from './logger';
Expand Down Expand Up @@ -65,7 +65,7 @@ type FCMError = {
* - For 429 errors: retry after waiting for the duration set in the retry-after header. If no retry-after header is set, default to 60 seconds.
* - For 500 errors: retry with exponential backoff.
*/
async function fetchWithRetry(url: string, _removeToken: () => void, options: RequestInit, retries = 0): Promise<Response> {
async function fetchWithRetry(url: string, _removeToken: () => void, options: ExtendedFetchOptions, retries = 0): Promise<Response> {
const MAX_RETRIES = 5;
const response = await fetch(url, options);

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/settings/server/CachedSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export class CachedSettings
}

public getConfig = (config?: OverCustomSettingsConfig): SettingsConfig => ({
debounce: 500,
debounce: process.env.TEST_MODE ? 0 : 500,
...config,
});

Expand Down
134 changes: 74 additions & 60 deletions apps/meteor/tests/e2e/message-mentions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getMentionText = (username: string, kind?: number): string => {
return `Hello @${username}, how are you`;
};

test.describe.serial('message-mentions', () => {
test.describe.serial('Should not allow to send @all mention if permission to do so is disabled', () => {
let poHomeChannel: HomeChannel;

test.beforeEach(async ({ page }) => {
Expand All @@ -29,82 +29,96 @@ test.describe.serial('message-mentions', () => {
await page.goto('/home');
});

test('expect show "all" and "here" options', async () => {
await poHomeChannel.sidenav.openChat('general');
await poHomeChannel.content.inputMessage.type('@');
let targetChannel2: string;
test.beforeAll(async ({ api }) => {
expect((await api.post('/permissions.update', { permissions: [{ _id: 'mention-all', roles: [] }] })).status()).toBe(200);
});

await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="all"')).toBeVisible();
await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="here"')).toBeVisible();
test.afterAll(async ({ api }) => {
expect(
(
await api.post('/permissions.update', { permissions: [{ _id: 'mention-all', roles: ['admin', 'owner', 'moderator', 'user'] }] })
).status(),
).toBe(200);
await deleteChannel(api, targetChannel2);
});

test.describe('Should not allow to send @all mention if permission to do so is disabled', () => {
let targetChannel2: string;
test.beforeAll(async ({ api }) => {
expect((await api.post('/permissions.update', { permissions: [{ _id: 'mention-all', roles: [] }] })).status()).toBe(200);
});
test('expect to receive an error as notification when sending @all while permission is disabled', async ({ page }) => {
const adminPage = new HomeChannel(page);

test.afterAll(async ({ api }) => {
expect(
(
await api.post('/permissions.update', { permissions: [{ _id: 'mention-all', roles: ['admin', 'owner', 'moderator', 'user'] }] })
).status(),
).toBe(200);
await deleteChannel(api, targetChannel2);
await test.step('create private room', async () => {
targetChannel2 = faker.string.uuid();

await poHomeChannel.sidenav.openNewByLabel('Channel');
await poHomeChannel.sidenav.inputChannelName.type(targetChannel2);
await poHomeChannel.sidenav.btnCreate.click();

await expect(page).toHaveURL(`/group/${targetChannel2}`);
});
await test.step('receive notify message', async () => {
await adminPage.content.dispatchSlashCommand('@all');
await expect(adminPage.content.lastUserMessage).toContainText('Notify all in this room is not allowed');
});
});
});

test('expect to receive an error as notification when sending @all while permission is disabled', async ({ page }) => {
const adminPage = new HomeChannel(page);
test.describe.serial('Should not allow to send @here mention if permission to do so is disabled', () => {
let poHomeChannel: HomeChannel;

await test.step('create private room', async () => {
targetChannel2 = faker.string.uuid();
test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);

await poHomeChannel.sidenav.openNewByLabel('Channel');
await poHomeChannel.sidenav.inputChannelName.type(targetChannel2);
await poHomeChannel.sidenav.btnCreate.click();
await page.goto('/home');
});

await expect(page).toHaveURL(`/group/${targetChannel2}`);
});
await test.step('receive notify message', async () => {
await adminPage.sidenav.openChat(targetChannel2);
await adminPage.content.dispatchSlashCommand('@all');
await expect(adminPage.content.lastUserMessage).toContainText('Notify all in this room is not allowed');
});
});
let targetChannel2: string;
test.beforeAll(async ({ api }) => {
expect((await api.post('/permissions.update', { permissions: [{ _id: 'mention-here', roles: [] }] })).status()).toBe(200);
});

test.describe('Should not allow to send @here mention if permission to do so is disabled', () => {
let targetChannel2: string;
test.beforeAll(async ({ api }) => {
expect((await api.post('/permissions.update', { permissions: [{ _id: 'mention-here', roles: [] }] })).status()).toBe(200);
});
test.afterAll(async ({ api }) => {
expect(
(
await api.post('/permissions.update', { permissions: [{ _id: 'mention-here', roles: ['admin', 'owner', 'moderator', 'user'] }] })
).status(),
).toBe(200);
await deleteChannel(api, targetChannel2);
});

test.afterAll(async ({ api }) => {
expect(
(
await api.post('/permissions.update', { permissions: [{ _id: 'mention-here', roles: ['admin', 'owner', 'moderator', 'user'] }] })
).status(),
).toBe(200);
await deleteChannel(api, targetChannel2);
test('expect to receive an error as notification when sending here while permission is disabled', async ({ page }) => {
const adminPage = new HomeChannel(page);

await test.step('create private room', async () => {
targetChannel2 = faker.string.uuid();

await poHomeChannel.sidenav.openNewByLabel('Channel');
await poHomeChannel.sidenav.inputChannelName.type(targetChannel2);
await poHomeChannel.sidenav.btnCreate.click();

await expect(page).toHaveURL(`/group/${targetChannel2}`);
});
await test.step('receive notify message', async () => {
await adminPage.content.dispatchSlashCommand('@here');
await expect(adminPage.content.lastUserMessage).toContainText('Notify all in this room is not allowed');
});
});
});

test('expect to receive an error as notification when sending here while permission is disabled', async ({ page }) => {
const adminPage = new HomeChannel(page);
test.describe.serial('message-mentions', () => {
let poHomeChannel: HomeChannel;

await test.step('create private room', async () => {
targetChannel2 = faker.string.uuid();
test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);

await poHomeChannel.sidenav.openNewByLabel('Channel');
await poHomeChannel.sidenav.inputChannelName.type(targetChannel2);
await poHomeChannel.sidenav.btnCreate.click();
await page.goto('/home');
});

await expect(page).toHaveURL(`/group/${targetChannel2}`);
});
await test.step('receive notify message', async () => {
await adminPage.sidenav.openChat(targetChannel2);
await adminPage.content.dispatchSlashCommand('@here');
await expect(adminPage.content.lastUserMessage).toContainText('Notify all in this room is not allowed');
});
});
test('expect show "all" and "here" options', async () => {
await poHomeChannel.sidenav.openChat('general');
await poHomeChannel.content.inputMessage.type('@');

await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="all"')).toBeVisible();
await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="here"')).toBeVisible();
});

test.describe('users not in channel', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,10 @@ test.describe('OC - Livechat API', () => {
await poLiveChat.btnSendMessageToOnlineAgent.click();

await expect(poLiveChat.txtChatMessage('this_a_test_message_from_visitor_1')).toBeVisible();
// wait for load messages to happen
await page.waitForResponse((response) => response.url().includes(`token=${registerGuestVisitor1.token}`));

await poAuxContext.poHomeOmnichannel.sidenav.openChat(registerGuestVisitor1.name);
await poAuxContext.poHomeOmnichannel.content.sendMessage('this_is_a_test_message_from_agent');
await expect(poLiveChat.txtChatMessage('this_is_a_test_message_from_agent')).toBeVisible();
});

await test.step('Expect registerGuest to create guest 2', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class HomeContent {
async dispatchSlashCommand(text: string): Promise<void> {
await this.joinRoomIfNeeded();
await this.page.waitForSelector('[name="msg"]:not([disabled])');
await this.page.locator('[name="msg"]').fill('');
await this.page.locator('[name="msg"]').type(text);
await this.page.keyboard.press('Enter');
await this.page.keyboard.press('Enter');
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/af.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"API_EmbedCacheExpirationDays": "Voeg die Cache Vervaldatums in",
"API_Enable_CORS": "Aktiveer KORS",
"API_Enable_Direct_Message_History_EndPoint": "Aktiveer Direkte Boodskap Geskiedenis Eindpunt",
"API_Enable_Direct_Message_History_EndPoint_Description": "Dit stel die `/ api / v1 / im.history.others` in staat wat die aanskouing van direkte boodskappe wat deur ander gebruikers gestuur word, waarna die beller nie deel is nie, toelaat.",
"API_Enable_Direct_Message_History_EndPoint_Description": "Dit stel die `/ api / v1 / im.messages.others` in staat wat die aanskouing van direkte boodskappe wat deur ander gebruikers gestuur word, waarna die beller nie deel is nie, toelaat.",
"API_Enable_Shields": "Aktiveer skilde",
"API_Enable_Shields_Description": "Aktiveer skilde beskikbaar by `/ api / v1 / shield.svg`",
"API_GitHub_Enterprise_URL": "Bediener-URL",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/ar.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
"API_EmbedCacheExpirationDays": "تضمين أيام انتهاء صلاحية ذاكرة التخزين المؤقت",
"API_Enable_CORS": "تمكين CORS",
"API_Enable_Direct_Message_History_EndPoint": "تمكين نقطة نهاية محفوظات الرسائل المباشرة",
"API_Enable_Direct_Message_History_EndPoint_Description": "يمكّن ذلك ‎`/api/v1/im.history.others`‎ الذي يسمح بعرض الرسائل المباشرة المرسلة من قِبل المستخدمين الآخرين الذين لا يكون المتصل جزءًا منهم.",
"API_Enable_Direct_Message_History_EndPoint_Description": "يمكّن ذلك ‎`/api/v1/im.messages.others`‎ الذي يسمح بعرض الرسائل المباشرة المرسلة من قِبل المستخدمين الآخرين الذين لا يكون المتصل جزءًا منهم.",
"API_Enable_Personal_Access_Tokens": "تمكين الرموز المميزة للوصول الشخصي إلى واجهة برمجة تطبيقات REST",
"API_Enable_Personal_Access_Tokens_Description": "تمكين الرموز المميزة للوصول الشخصي للاستخدام مع واجهة برمجة تطبيقات REST",
"API_Enable_Rate_Limiter": "تمكين محدد المعدل",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/az.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"API_EmbedCacheExpirationDays": "Cache Expiration Günləri Embed",
"API_Enable_CORS": "CORS'i aktiv edin",
"API_Enable_Direct_Message_History_EndPoint": "Birbaşa mesaj tarixinin son nöqtəsini aktiv edin",
"API_Enable_Direct_Message_History_EndPoint_Description": "Bu, digər istifadəçilər tərəfindən göndərilən birbaşa mesajların bir hissəsi olmadığını göstərən \"/ api / v1 / im.history.others\" a imkan verir.",
"API_Enable_Direct_Message_History_EndPoint_Description": "Bu, digər istifadəçilər tərəfindən göndərilən birbaşa mesajların bir hissəsi olmadığını göstərən \"/ api / v1 / im.messages.others\" a imkan verir.",
"API_Enable_Shields": "Qalxanları aktiv edin",
"API_Enable_Shields_Description": "'/ Api / v1 / shield.svg` səhifəsində mövcud olan qalxanları aktiv edin",
"API_GitHub_Enterprise_URL": "Server URL",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/be-BY.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
"API_EmbedCacheExpirationDays": "Уставіць кэш Заканчэнне дзён",
"API_Enable_CORS": "ўключэнне CORS",
"API_Enable_Direct_Message_History_EndPoint": "Enable Direct Message History Конточка",
"API_Enable_Direct_Message_History_EndPoint_Description": "Гэта дазваляе `/ API / v1 / im.history.others`, якая дазваляе праглядаць прамыя паведамленні, адпраўленыя іншымі карыстальнікамі, што абанент не з'яўляецца часткай.",
"API_Enable_Direct_Message_History_EndPoint_Description": "Гэта дазваляе `/ API / v1 / im.messages.others`, якая дазваляе праглядаць прамыя паведамленні, адпраўленыя іншымі карыстальнікамі, што абанент не з'яўляецца часткай.",
"API_Enable_Shields": "ўключыць Шылдс",
"API_Enable_Shields_Description": "Ўключыць экраны, даступныя ў `/ API / v1 / shield.svg`",
"API_GitHub_Enterprise_URL": "URL-адрас сервера",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/bg.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"API_EmbedCacheExpirationDays": "Вграждане на дни на изтичане на кеша",
"API_Enable_CORS": "Активирайте CORS",
"API_Enable_Direct_Message_History_EndPoint": "Активирайте крайната точка на историята на директните съобщения",
"API_Enable_Direct_Message_History_EndPoint_Description": "Това дава възможност на \"/ api / v1 / im.history.others\", който позволява преглеждането на директни съобщения, изпратени от други потребители, от които повикващият не е част.",
"API_Enable_Direct_Message_History_EndPoint_Description": "Това дава възможност на \"/ api / v1 / im.messages.others\", който позволява преглеждането на директни съобщения, изпратени от други потребители, от които повикващият не е част.",
"API_Enable_Shields": "Активирайте щитовете",
"API_Enable_Shields_Description": "Активиране на щитове на разположение на \"/ api / v1 / shield.svg\"",
"API_GitHub_Enterprise_URL": "URL адрес на сървъра",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/bs.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"API_EmbedCacheExpirationDays": "Ugradite Dani isteka predmemorije",
"API_Enable_CORS": "Omogući CORS",
"API_Enable_Direct_Message_History_EndPoint": "Omogući završnu točku izravne poruke",
"API_Enable_Direct_Message_History_EndPoint_Description": "To omogućuje `/ api / v1 / im.history.others` koji omogućuje gledanje izravnih poruka koje su drugi korisnici poslali da pozivatelj nije dio.",
"API_Enable_Direct_Message_History_EndPoint_Description": "To omogućuje `/ api / v1 / im.messages.others` koji omogućuje gledanje izravnih poruka koje su drugi korisnici poslali da pozivatelj nije dio.",
"API_Enable_Shields": "Omogući štitove",
"API_Enable_Shields_Description": "Omogući štitove dostupne na `/ api / v1 / shield.svg`",
"API_GitHub_Enterprise_URL": "GitHub Enterprise URL",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/ca.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
"API_EmbedCacheExpirationDays": "Caducitat de la memòria cau de les incrustacions (en dies)",
"API_Enable_CORS": "Activa CORS",
"API_Enable_Direct_Message_History_EndPoint": "Activa la consulta de l'historial de missatges directes",
"API_Enable_Direct_Message_History_EndPoint_Description": "Això activa el `/api/v1/im.history.others` que permet veure missatges directes enviats per altres usuaris tot i no formar-ne part.",
"API_Enable_Direct_Message_History_EndPoint_Description": "Això activa el `/api/v1/im.messages.others` que permet veure missatges directes enviats per altres usuaris tot i no formar-ne part.",
"API_Enable_Personal_Access_Tokens": "Habilitar els tokens d'accés personal a l'API REST",
"API_Enable_Personal_Access_Tokens_Description": "Habiliteu tokens d'accés personal per al seu ús amb l'API REST",
"API_Enable_Rate_Limiter": "Habilitar limitador de freqüència",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/cs.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
"API_EmbedCacheExpirationDays": "Počet dní expirace cache embed",
"API_Enable_CORS": "Povolit CORS",
"API_Enable_Direct_Message_History_EndPoint": "Povolit Endpoint přímých zpráv",
"API_Enable_Direct_Message_History_EndPoint_Description": "Povolí endpoint `/api/v1/im.history.others` přes který lze stahovat přímé zprávy mezi všemi uživateli.",
"API_Enable_Direct_Message_History_EndPoint_Description": "Povolí endpoint `/api/v1/im.messages.others` přes který lze stahovat přímé zprávy mezi všemi uživateli.",
"API_Enable_Personal_Access_Tokens": "Povolit tokeny osobního přístupu pro rozhraní REST API",
"API_Enable_Personal_Access_Tokens_Description": "Povolit tokeny osobního přístupu pro použití s rozhraním REST API",
"API_Enable_Rate_Limiter": "Povolit rychlostní limit",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/cy.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"API_EmbedCacheExpirationDays": "Embed Diwrnodau Terfynu Cache",
"API_Enable_CORS": "Galluogi CORS",
"API_Enable_Direct_Message_History_EndPoint": "Galluogi Endpoint Hanes Negeseuon Uniongyrchol",
"API_Enable_Direct_Message_History_EndPoint_Description": "Mae hyn yn galluogi'r `/ api / v1 / im.history.others` sy'n caniatáu gwylio negeseuon uniongyrchol a anfonir gan ddefnyddwyr eraill nad yw'r galwr yn rhan ohoni.",
"API_Enable_Direct_Message_History_EndPoint_Description": "Mae hyn yn galluogi'r `/ api / v1 / im.messages.others` sy'n caniatáu gwylio negeseuon uniongyrchol a anfonir gan ddefnyddwyr eraill nad yw'r galwr yn rhan ohoni.",
"API_Enable_Shields": "Galluogi Shields",
"API_Enable_Shields_Description": "Galluogi darnau ar gael yn `/ api / v1 / shield.svg`",
"API_GitHub_Enterprise_URL": "URL Gweinyddwr",
Expand Down
Loading

0 comments on commit bb30b5f

Please sign in to comment.