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/stupid-cameras-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes administration settings page not listing the settings after logging out and back into the workspace
7 changes: 2 additions & 5 deletions apps/meteor/client/providers/AuthorizationProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AuthorizationContext, useUserId } from '@rocket.chat/ui-contexts';
import type { ReactNode } from 'react';
import { useEffect, useMemo } from 'react';
import { useMemo } from 'react';

import { hasPermission, hasAtLeastOnePermission, hasAllPermission, hasRole } from '../../app/authorization/client';
import { PermissionsCachedStore } from '../cachedStores';
Expand All @@ -12,14 +12,11 @@ type AuthorizationProviderProps = {
};

const AuthorizationProvider = ({ children }: AuthorizationProviderProps) => {
useEffect(() => {
PermissionsCachedStore.listen();
}, []);

const isLoading = !PermissionsCachedStore.useReady();

if (isLoading) {
throw (async () => {
PermissionsCachedStore.listen();
await PermissionsCachedStore.init();
})();
}
Expand Down
5 changes: 5 additions & 0 deletions apps/meteor/client/providers/SettingsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { ReactNode } from 'react';
import { useCallback, useMemo } from 'react';

import { PublicSettingsCachedStore, PrivateSettingsCachedStore } from '../cachedStores';
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
import { applyQueryOptions } from '../lib/cachedStores/applyQueryOptions';

const settingsManagementPermissions = ['view-privileged-setting', 'edit-privileged-setting', 'manage-selected-settings'];
Expand All @@ -24,6 +25,10 @@ const SettingsProvider = ({ children }: SettingsProviderProps) => {

if (isLoading) {
throw (async () => {
if (cachedCollection instanceof PrivateCachedStore) {
cachedCollection.listen();
}

await cachedCollection.init();
})();
}
Expand Down
33 changes: 32 additions & 1 deletion apps/meteor/tests/e2e/administration-settings.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
import { Users } from './fixtures/userStates';
import { AdminSettings } from './page-objects';
import { AdminSettings, AdminSectionsHref } from './page-objects';
import { HomeSidenav } from './page-objects/fragments';
import { LoginPage } from './page-objects/login';
import { getSettingValueById, setSettingValueById } from './utils';
import { test, expect } from './utils/test';

test.use({ storageState: Users.admin.state });

test.describe.parallel('administration-settings', () => {
let poAdminSettings: AdminSettings;
let poHomeSidenav: HomeSidenav;
let poLoginPage: LoginPage;

test.beforeEach(async ({ page }) => {
poAdminSettings = new AdminSettings(page);
poHomeSidenav = new HomeSidenav(page);
poLoginPage = new LoginPage(page);
});

test.describe('Settings Page', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/admin/settings');
});

test('should display settings list', async ({ page }) => {
await test.step('should list settings on load', async () => {
await expect(page.getByText('No results found')).not.toBeVisible();
});

await test.step('should list settings after logout and login', async () => {
await poAdminSettings.sidebar.close();
await poHomeSidenav.logout();

await poLoginPage.loginByUserState(Users.admin);

await poHomeSidenav.openAdministrationByLabel('Workspace');
const settingsButton = await poAdminSettings.adminSectionButton(AdminSectionsHref.Settings);
await settingsButton.click();

await expect(page.getByText('No results found')).not.toBeVisible();
});
});
});

test.describe('General', () => {
Expand Down
Loading