chore: remove completed migration feature flags and upgrade commands <= 1.18 (#19074)
## Summary - Remove 3 completed migration feature flags: `IS_ATTACHMENT_MIGRATED`, `IS_NOTE_TARGET_MIGRATED`, `IS_TASK_TARGET_MIGRATED` — these were already enabled by default for all new workspaces via `DEFAULT_FEATURE_FLAGS` - Delete all upgrade command directories for versions <= 1.18 (`1-16/`, `1-17/`, `1-18/`) along with their module registrations, removing ~6,600 lines of dead migration code - Simplify frontend utility functions (`getActivityTargetObjectFieldIdName`, `getActivityTargetsFilter`, `getActivityTargetFieldNameForObject`, `generateActivityTargetMorphFieldKeys`, `findActivitiesOperationSignatureFactory`) by removing the `isMorphRelation` parameter and always using the morph relation path - Remove feature flag checks from 7 frontend hooks/components that were gating attachment and activity target behavior behind the removed flags - Simplify `buildDefaultRelationFlatFieldMetadatasForCustomObject` server util to always treat attachment, noteTarget, and taskTarget as morph relations without checking feature flags
This commit is contained in:
-1
@@ -406,7 +406,6 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
createObjectInput,
|
||||
flatApplication: resolvedOwnerFlatApplication,
|
||||
flatObjectMetadataMaps: existingFlatObjectMetadataMaps,
|
||||
existingFeatureFlagsMap,
|
||||
});
|
||||
|
||||
const flatDefaultViewToCreate = this.computeFlatViewToCreate({
|
||||
|
||||
+5
-24
@@ -2,10 +2,9 @@ import {
|
||||
STANDARD_OBJECTS,
|
||||
DEFAULT_RELATIONS_OBJECTS_STANDARD_IDS,
|
||||
} from 'twenty-shared/metadata';
|
||||
import { FieldMetadataType, FeatureFlagKey } from 'twenty-shared/types';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { capitalize, isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { type FeatureFlagMap } from 'src/engine/core-modules/feature-flag/interfaces/feature-flag-map.interface';
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
|
||||
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
|
||||
@@ -34,14 +33,7 @@ const morphIdByRelationObjectNameSingular = {
|
||||
string | null
|
||||
>;
|
||||
|
||||
// TODO: once we have finished migrating, we can delete custom code
|
||||
// once we migrate timeline activity to morph relations, we can add it.
|
||||
// another way to check if an object is migrated to morph relations is to check if the feature flag is enabled
|
||||
const DEFAULT_MORPH_RELATIONS_OBJECTS_STANDARD_IDS =
|
||||
[] as const satisfies (keyof typeof STANDARD_OBJECTS)[];
|
||||
|
||||
export type BuildDefaultRelationFieldsForCustomObjectArgs = {
|
||||
existingFeatureFlagsMap: FeatureFlagMap;
|
||||
existingFlatObjectMetadataMaps: FlatEntityMaps<FlatObjectMetadata>;
|
||||
sourceFlatObjectMetadata: UniversalFlatObjectMetadata;
|
||||
flatApplication: FlatApplication;
|
||||
@@ -58,7 +50,6 @@ const EMPTY_SOURCE_AND_TARGET_FLAT_FIELD_METADATAS_RECORD: SourceAndTargetFlatFi
|
||||
};
|
||||
|
||||
export const buildDefaultRelationFlatFieldMetadatasForCustomObject = ({
|
||||
existingFeatureFlagsMap,
|
||||
existingFlatObjectMetadataMaps,
|
||||
sourceFlatObjectMetadata,
|
||||
flatApplication,
|
||||
@@ -79,21 +70,11 @@ export const buildDefaultRelationFlatFieldMetadatasForCustomObject = ({
|
||||
const result =
|
||||
DEFAULT_RELATIONS_OBJECTS_STANDARD_IDS.reduce<SourceAndTargetFlatFieldMetadatasRecord>(
|
||||
(sourceAndTargetFlatFieldMetadatasRecord, objectMetadataNameSingular) => {
|
||||
const isObjectMigratedFromOlderReleases =
|
||||
DEFAULT_MORPH_RELATIONS_OBJECTS_STANDARD_IDS.map(toString).includes(
|
||||
objectMetadataNameSingular,
|
||||
);
|
||||
const isFeatureFlagEnabled =
|
||||
objectMetadataNameSingular === 'timelineActivity' ||
|
||||
(objectMetadataNameSingular === 'attachment' &&
|
||||
existingFeatureFlagsMap[FeatureFlagKey.IS_ATTACHMENT_MIGRATED]) ||
|
||||
(objectMetadataNameSingular === 'noteTarget' &&
|
||||
existingFeatureFlagsMap[FeatureFlagKey.IS_NOTE_TARGET_MIGRATED]) ||
|
||||
(objectMetadataNameSingular === 'taskTarget' &&
|
||||
existingFeatureFlagsMap[FeatureFlagKey.IS_TASK_TARGET_MIGRATED]) ||
|
||||
false;
|
||||
const isObjectMigratedToMorphRelations =
|
||||
isObjectMigratedFromOlderReleases || isFeatureFlagEnabled;
|
||||
objectMetadataNameSingular === 'timelineActivity' ||
|
||||
objectMetadataNameSingular === 'attachment' ||
|
||||
objectMetadataNameSingular === 'noteTarget' ||
|
||||
objectMetadataNameSingular === 'taskTarget';
|
||||
|
||||
const targetFlatObjectMetadataId =
|
||||
objectIdByNameSingular[objectMetadataNameSingular];
|
||||
|
||||
Reference in New Issue
Block a user