Skip to content

Commit 01c9c2d

Browse files
authored
refactor: revert organization-level custom css db alteration (#7737)
* Revert "feat(schemas): add organization level custom css support" This reverts commit 6cd7ea9. * Revert "feat(core): add org-level custom css support in sign-in-exp API (#7733)" This reverts commit fba9ef2.
1 parent fba9ef2 commit 01c9c2d

File tree

5 files changed

+2
-74
lines changed

5 files changed

+2
-74
lines changed

packages/core/src/libraries/sign-in-experience/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,11 @@ export const createSignInExperienceLibrary = (
131131
return;
132132
}
133133
const organization = await trySafe(organizations.findById(organizationId));
134-
const { branding, customCss } = organization ?? {};
135-
136-
if (!branding && !customCss) {
134+
if (!organization?.branding) {
137135
return;
138136
}
139137

140-
return {
141-
...(branding && { branding }),
142-
...(customCss && { customCss }),
143-
};
138+
return { branding: organization.branding };
144139
};
145140

146141
const findApplicationSignInExperience = async (appId?: string) => {

packages/integration-tests/src/tests/api/organization/organization.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,11 @@ describe('organization APIs', () => {
119119
const organization = await organizationApi.update(createdOrganization.id, {
120120
name: 'test2',
121121
description: 'test description.',
122-
customCss: 'test css',
123122
});
124123
expect(organization).toStrictEqual({
125124
...createdOrganization,
126125
name: 'test2',
127126
description: 'test description.',
128-
customCss: 'test css',
129127
});
130128
});
131129

packages/integration-tests/src/tests/experience/overrides.test.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ describe('overrides', () => {
3535
favicon: 'mock://fake-url-for-omni/favicon.ico',
3636
darkFavicon: 'mock://fake-url-for-omni/dark-favicon.ico',
3737
} satisfies Branding);
38-
const omniCustomCss = '.logto_main-content { background-color: #f00 !important; }';
3938

4039
const appColor = Object.freeze({
4140
primaryColor: '#00f',
@@ -53,7 +52,6 @@ describe('overrides', () => {
5352
logoUrl: 'mock://fake-url-for-org/logo.png',
5453
darkLogoUrl: 'mock://fake-url-for-org/dark-logo.png',
5554
} satisfies Branding);
56-
const organizationCustomCss = '.logto_main-content { background-color: #0f0 !important; }';
5755

5856
afterEach(async () => {
5957
await organizationApi.cleanUp();
@@ -66,7 +64,6 @@ describe('overrides', () => {
6664
privacyPolicyUrl: null,
6765
color: omniColor,
6866
branding: omniBranding,
69-
customCss: omniCustomCss,
7067
signUp: { identifiers: [], password: true, verify: false },
7168
signIn: {
7269
methods: [
@@ -237,42 +234,11 @@ describe('overrides', () => {
237234
await deleteApplication(application.id);
238235
});
239236

240-
it('should apply omni custom CSS', async () => {
241-
const experience = new ExpectExperience(await browser.newPage());
242-
await experience.navigateTo(demoAppUrl.href);
243-
const element = await experience.toMatchElement('main.logto_main-content');
244-
expect(
245-
await element.evaluate((element) => window.getComputedStyle(element).backgroundColor)
246-
).toBe('rgb(255, 0, 0)');
247-
248-
await experience.page.close();
249-
});
250-
251-
it('should apply organization-level custom CSS over omni custom CSS', async () => {
252-
const organization = await organizationApi.create({
253-
name: 'Sign-in experience override',
254-
});
255-
256-
await organizationApi.update(organization.id, {
257-
customCss: organizationCustomCss,
258-
});
259-
260-
const experience = new ExpectExperience(await browser.newPage());
261-
await experience.navigateTo(demoAppUrl.href + `?organization_id=${organization.id}`);
262-
const element = await experience.toMatchElement('main.logto_main-content');
263-
expect(
264-
await element.evaluate((element) => window.getComputedStyle(element).backgroundColor)
265-
).toBe('rgb(0, 255, 0)');
266-
267-
await experience.page.close();
268-
});
269-
270237
describe('override fallback', () => {
271238
beforeAll(async () => {
272239
await updateSignInExperience({
273240
color: omniColor,
274241
branding: pick(omniBranding, 'logoUrl', 'favicon'),
275-
customCss: omniCustomCss,
276242
});
277243
});
278244

@@ -335,19 +301,4 @@ describe('overrides', () => {
335301
await deleteApplication(application.id);
336302
await experience.page.close();
337303
});
338-
339-
it('should fallback to omni custom CSS when organization-level custom CSS is not provided', async () => {
340-
const organization = await organizationApi.create({
341-
name: 'Sign-in experience override',
342-
});
343-
344-
const experience = new ExpectExperience(await browser.newPage());
345-
await experience.navigateTo(demoAppUrl.href + `?organization_id=${organization.id}`);
346-
const element = await experience.toMatchElement('main.logto_main-content');
347-
expect(
348-
await element.evaluate((element) => window.getComputedStyle(element).backgroundColor)
349-
).toBe('rgb(255, 0, 0)');
350-
351-
await experience.page.close();
352-
});
353304
});

packages/schemas/alterations/next-1756191517-add-organization-custom-css.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/schemas/tables/organizations.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ create table organizations (
1212
description varchar(256),
1313
/** Additional data associated with the organization. */
1414
custom_data jsonb /* @use JsonObject */ not null default '{}'::jsonb,
15-
/** The custom CSS of the organization. */
16-
custom_css text,
1715
/** Whether multi-factor authentication configuration is required for the members of the organization. */
1816
is_mfa_required boolean not null default false,
1917
/** The organization's branding configuration. */

0 commit comments

Comments
 (0)