Skip to content

Commit

Permalink
Merge branch 'develop' into fix/join-code-editing-user
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-rajpal authored Feb 20, 2024
2 parents ce54b03 + 1738e14 commit 33ae8f7
Show file tree
Hide file tree
Showing 20 changed files with 190 additions and 76 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-dodos-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue not allowing admin users to edit the room name
5 changes: 5 additions & 0 deletions .changeset/large-toys-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fixed an issue with the user presence not updating automatically for other users.
5 changes: 5 additions & 0 deletions .changeset/lucky-ducks-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed an issue where the login button for Custom OAuth services would not work if any non-custom login service was also available
5 changes: 5 additions & 0 deletions .changeset/silver-chicken-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/livechat": patch
---

fixed livechat UI blinking different colors when the chat is finished
1 change: 1 addition & 0 deletions apps/meteor/app/notifications/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './lib/Presence';
4 changes: 3 additions & 1 deletion apps/meteor/app/notifications/client/lib/Presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Presence } from '../../../../client/lib/presence';

new Meteor.Streamer('user-presence');

Meteor.StreamerCentral.on('stream-user-presence', (uid: string, username: string, statusChanged?: UserStatus, statusText?: string) => {
type args = [username: string, statusChanged?: UserStatus, statusText?: string];

Meteor.StreamerCentral.on('stream-user-presence', (uid: string, [username, statusChanged, statusText]: args) => {
Presence.notify({ _id: uid, username, status: statusChanged, statusText });
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ const ReactionTooltip = ({ emojiName, usernames, mine, messageId, showRealName,
if (isLoading) {
return (
<>
<Skeleton width='x200' variant='text' backgroundColor='black' />
<Skeleton width='x200' variant='text' backgroundColor='black' />
{usernames.length > 5 && <Skeleton width='x200' variant='text' backgroundColor='black' />}
{usernames.length > 8 && <Skeleton width='x200' variant='text' backgroundColor='black' />}
<Skeleton width='x200' variant='text' backgroundColor='surface-light' />
<Skeleton width='x200' variant='text' backgroundColor='surface-light' />
{usernames.length > 5 && <Skeleton width='x200' variant='text' backgroundColor='surface-light' />}
{usernames.length > 8 && <Skeleton width='x200' variant='text' backgroundColor='surface-light' />}
</>
);
}
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/client/importPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import '../app/iframe-login/client';
import '../app/lib/client';
import '../app/message-mark-as-unread/client';
import '../app/nextcloud/client';
import '../app/notifications/client';
import '../app/otr/client';
import '../app/slackbridge/client';
import '../app/slashcommands-archiveroom/client';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/startup/customOAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Meteor.startup(() => {
loginServices.onLoad((services) => {
for (const service of services) {
if (!('custom' in service && service.custom)) {
return;
continue;
}

new CustomOAuth(service.service, {
Expand Down
4 changes: 1 addition & 3 deletions apps/meteor/client/views/admin/rooms/EditRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,14 @@ const EditRoom = ({ room, onChange, onDelete }: EditRoomProps) => {

const handleArchive = useArchiveRoom(room);

const handleUpdateRoomData = useEffectEvent(async ({ isDefault, roomName, favorite, ...formData }) => {
const handleUpdateRoomData = useEffectEvent(async ({ isDefault, favorite, ...formData }) => {
const data = getDirtyFields(formData, dirtyFields);
delete data.archived;
delete data.favorite;
delete data.roomName;

try {
await saveAction({
rid: room._id,
roomName: roomType === 'd' ? undefined : roomName,
default: isDefault,
favorite: { defaultValue: isDefault, favorite },
...data,
Expand Down
15 changes: 13 additions & 2 deletions apps/meteor/tests/e2e/administration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@ test.describe.parallel('administration', () => {
await page.waitForSelector('[qa-room-id="GENERAL"]');
});

test('should edit target channel', async () => {
test('should edit target channel name', async () => {
await poAdmin.inputSearchRooms.fill(targetChannel);
await poAdmin.getRoomRow(targetChannel).click();
await poAdmin.roomNameInput.fill(`${targetChannel}-edited`);
await poAdmin.btnSave.click();

await expect(poAdmin.getRoomRow(targetChannel)).toContainText(`${targetChannel}-edited`);

targetChannel = `${targetChannel}-edited`;
});

test('should edit target channel type', async () => {
await poAdmin.inputSearchRooms.type(targetChannel);
await poAdmin.getRoomRow(targetChannel).click();
await poAdmin.privateLabel.click();
Expand All @@ -89,7 +100,7 @@ test.describe.parallel('administration', () => {
});

test.describe.serial('Default rooms', () => {
test('expect target channell to be default', async () => {
test('expect target channel to be default', async () => {
await poAdmin.inputSearchRooms.type(targetChannel);
await poAdmin.getRoomRow(targetChannel).click();
await poAdmin.defaultLabel.click();
Expand Down
3 changes: 3 additions & 0 deletions apps/meteor/tests/e2e/config/global-setup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import addCustomOAuth from '../fixtures/addCustomOAuth';
import injectInitialData from '../fixtures/inject-initial-data';
import insertApp from '../fixtures/insert-apps';

export default async function (): Promise<void> {
await injectInitialData();

await insertApp();

await addCustomOAuth();
}
18 changes: 18 additions & 0 deletions apps/meteor/tests/e2e/fixtures/addCustomOAuth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { request } from '@playwright/test';

import { BASE_API_URL } from '../config/constants';
import { Users } from './userStates';

export default async function addCustomOAuth(): Promise<void> {
const api = await request.newContext();

const headers = {
'X-Auth-Token': Users.admin.data.loginToken,
'X-User-Id': Users.admin.data.username,
};

await api.post(`${BASE_API_URL}/settings.addCustomOAuth`, { data: { name: 'Test' }, headers });
await api.post(`${BASE_API_URL}/settings/Accounts_OAuth_Custom-Test`, { data: { value: false }, headers });
await api.post(`${BASE_API_URL}/settings/Accounts_OAuth_Custom-Test-url`, { data: { value: 'https://rocket.chat' }, headers });
await api.post(`${BASE_API_URL}/settings/Accounts_OAuth_Custom-Test-login_style`, { data: { value: 'redirect' }, headers });
}
2 changes: 1 addition & 1 deletion apps/meteor/tests/e2e/fixtures/userStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type IUserState = {
};

function generateContext(username: string): IUserState {
const date = new Date('2023-02-17T20:38:12.306Z');
const date = new Date();
date.setFullYear(date.getFullYear() + 1);

const token = {
Expand Down
21 changes: 21 additions & 0 deletions apps/meteor/tests/e2e/oauth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,33 @@ test.describe('OAuth', () => {
await expect(poRegistration.btnLoginWithGoogle).toBeVisible();
});

await test.step('expect Custom OAuth button to be visible', async () => {
await expect((await setSettingValueById(api, 'Accounts_OAuth_Custom-Test', true)).status()).toBe(200);
await page.waitForTimeout(5000);
await page.goto('/home');

await expect(poRegistration.btnLoginWithCustomOAuth).toBeVisible();
});

await test.step('expect redirect to the configured URL.', async () => {
await poRegistration.btnLoginWithCustomOAuth.click();
await expect(page).toHaveURL(/https\:\/\/(www)?\.rocket\.chat/);
});

await test.step('expect OAuth button to not be visible', async () => {
await expect((await setSettingValueById(api, 'Accounts_OAuth_Google', false)).status()).toBe(200);
await page.waitForTimeout(5000);

await page.goto('/home');
await expect(poRegistration.btnLoginWithGoogle).not.toBeVisible();
});

await test.step('expect Custom OAuth button to not be visible', async () => {
await expect((await setSettingValueById(api, 'Accounts_OAuth_Custom-Test', false)).status()).toBe(200);
await page.waitForTimeout(5000);

await page.goto('/home');
await expect(poRegistration.btnLoginWithCustomOAuth).not.toBeVisible();
});
});
});
4 changes: 4 additions & 0 deletions apps/meteor/tests/e2e/page-objects/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export class Admin {
return this.page.locator(`label >> text=Private`);
}

get roomNameInput(): Locator {
return this.page.locator('input[name="roomName"]');
}

get archivedLabel(): Locator {
return this.page.locator('label >> text=Archived');
}
Expand Down
4 changes: 4 additions & 0 deletions apps/meteor/tests/e2e/page-objects/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export class Registration {
return this.page.locator('role=button[name="Sign in with Google"]');
}

get btnLoginWithCustomOAuth(): Locator {
return this.page.locator('role=button[name="Sign in with Test"]');
}

get goToRegister(): Locator {
return this.page.locator('role=link[name="Create an account"]');
}
Expand Down
29 changes: 20 additions & 9 deletions apps/meteor/tests/end-to-end/api/22-push.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { before, describe, it } from 'mocha';
import { before, describe, it, after } from 'mocha';

import { getCredentials, api, request, credentials } from '../../data/api-data.js';
import { updateSetting } from '../../data/permissions.helper';
Expand Down Expand Up @@ -193,11 +193,21 @@ describe('[Push]', function () {
});

describe('[/push.info]', () => {
before(async () => {
await updateSetting('Push_enable', true);
await updateSetting('Push_enable_gateway', true);
await updateSetting('Push_gateway', 'https://random-gateway.rocket.chat');
});
before(() =>
Promise.all([
updateSetting('Push_enable', true),
updateSetting('Push_enable_gateway', true),
updateSetting('Push_gateway', 'https://random-gateway.rocket.chat'),
]),
);

after(() =>
Promise.all([
updateSetting('Push_enable', true),
updateSetting('Push_enable_gateway', true),
updateSetting('Push_gateway', 'https://gateway.rocket.chat'),
]),
);

it('should fail if not logged in', async () => {
await request
Expand Down Expand Up @@ -234,9 +244,10 @@ describe('[Push]', function () {
});

describe('[/push.test]', () => {
before(async () => {
await updateSetting('Push_enable', false);
});
before(() => updateSetting('Push_enable', false));

// TODO: Re-enable this test after fixing the issue with the push configure when enable/disable the setting
// after(() => updateSetting('Push_enable', true));

it('should fail if not logged in', async () => {
await request
Expand Down
Loading

0 comments on commit 33ae8f7

Please sign in to comment.