Skip to content

Commit

Permalink
hotfix: On cloning apps should not transform the data or do backward …
Browse files Browse the repository at this point in the history
…compatibility as cloning is only possible from the same tj version (#9154)

* fixes: on cloning apps should not transform the data or do backward compatibility
as cloning is only possible from the same tj version

---------

Co-authored-by: arpitnath <arpitnath42@gmail.com>
  • Loading branch information
stepinfwd and arpitnath committed Mar 22, 2024
1 parent d06ced2 commit 8796572
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.33.3
2.33.4
2 changes: 1 addition & 1 deletion frontend/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.33.3
2.33.4
2 changes: 1 addition & 1 deletion server/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.33.3
2.33.4
18 changes: 12 additions & 6 deletions server/src/services/app_import_export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export class AppImportExportService {
: isTooljetVersionWithNormalizedAppDefinitionSchem(importedAppTooljetVersion);

const importedApp = await this.createImportedAppForUser(this.entityManager, schemaUnifiedAppParams, user);
const currentTooljetVersion = !cloning ? tooljetVersion : null;

await this.setupImportedAppAssociations(
this.entityManager,
Expand All @@ -245,7 +246,7 @@ export class AppImportExportService {
user,
externalResourceMappings,
isNormalizedAppDefinitionSchema,
tooljetVersion
currentTooljetVersion
);
await this.createAdminGroupPermissions(this.entityManager, importedApp);

Expand Down Expand Up @@ -324,7 +325,7 @@ export class AppImportExportService {
user: User,
externalResourceMappings: Record<string, unknown>,
isNormalizedAppDefinitionSchema: boolean,
tooljetVersion: string
tooljetVersion: string | null
) {
// Old version without app version
// Handle exports prior to 0.12.0
Expand Down Expand Up @@ -587,7 +588,7 @@ export class AppImportExportService {
importingPages: Page[],
importingComponents: Component[],
importingEvents: EventHandler[],
tooljetVersion: string
tooljetVersion: string | null
): Promise<AppResourceMappings> {
appResourceMappings = { ...appResourceMappings };

Expand Down Expand Up @@ -1693,15 +1694,20 @@ function migrateProperties(
componentType: NewRevampedComponent,
component: Component,
componentTypes: NewRevampedComponent[],
tooljetVersion: string
tooljetVersion: string | null
) {
const shouldHandleBackwardCompatibility = isVersionGreaterThanOrEqual(tooljetVersion, '2.29.0') ? false : true;

const properties = { ...component.properties };
const styles = { ...component.styles };
const general = { ...component.general };
const validation = { ...component.validation };
const generalStyles = { ...component.generalStyles };

if (!tooljetVersion) {
return { properties, styles, general, generalStyles, validation };
}

const shouldHandleBackwardCompatibility = isVersionGreaterThanOrEqual(tooljetVersion, '2.29.0') ? false : true;

// Check if the component type is included in the specified component types
if (componentTypes.includes(componentType as NewRevampedComponent)) {
if (styles.visibility) {
Expand Down

0 comments on commit 8796572

Please sign in to comment.