Fix field item type tag (#16860)
# Introduction This has been fixed on main already 1 hour ago, this PR now only passes the field application id instead of the object applicationId that could be different for example when creating a custom field on a standard object For the moment not introducing any logic around application integrity directly and still relying on the isCustom and standardId definition This will have to be refactored once we deprecate the standardId
This commit is contained in:
-62
@@ -1,62 +0,0 @@
|
||||
import { isObjectMetadataSettingsReadOnly } from '@/object-record/read-only/utils/isObjectMetadataSettingsReadOnly';
|
||||
|
||||
describe('isObjectMetadataSettingsReadOnly', () => {
|
||||
it('should return false if object can be updated and is not UI read only and is not remote', () => {
|
||||
const result = isObjectMetadataSettingsReadOnly({
|
||||
objectPermissions: {
|
||||
canUpdateObjectRecords: true,
|
||||
objectMetadataId: '123',
|
||||
restrictedFields: {},
|
||||
},
|
||||
objectMetadataItem: {
|
||||
isUIReadOnly: false,
|
||||
isRemote: false,
|
||||
},
|
||||
});
|
||||
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true if object is remote', () => {
|
||||
const result = isObjectMetadataSettingsReadOnly({
|
||||
objectPermissions: {
|
||||
canUpdateObjectRecords: true,
|
||||
objectMetadataId: '123',
|
||||
restrictedFields: {},
|
||||
},
|
||||
objectMetadataItem: {
|
||||
isUIReadOnly: false,
|
||||
isRemote: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true if object is UI read only', () => {
|
||||
const result = isObjectMetadataSettingsReadOnly({
|
||||
objectMetadataItem: {
|
||||
isUIReadOnly: true,
|
||||
isRemote: false,
|
||||
},
|
||||
});
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for standard/third-party objects (they are editable via standardOverrides)', () => {
|
||||
const result = isObjectMetadataSettingsReadOnly({
|
||||
objectPermissions: {
|
||||
canUpdateObjectRecords: true,
|
||||
objectMetadataId: '123',
|
||||
restrictedFields: {},
|
||||
},
|
||||
objectMetadataItem: {
|
||||
isUIReadOnly: false,
|
||||
isRemote: false,
|
||||
},
|
||||
});
|
||||
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObjectMetadataReadOnly';
|
||||
import { type ObjectPermission } from '~/generated/graphql';
|
||||
|
||||
type IsObjectMetadataSettingsReadOnlyParams = {
|
||||
objectPermissions?: ObjectPermission;
|
||||
objectMetadataItem?: Pick<ObjectMetadataItem, 'isUIReadOnly' | 'isRemote'>;
|
||||
};
|
||||
|
||||
// Returns true only for remote or UI read-only objects
|
||||
// Standard and third-party app objects are editable (label/icon/description via standardOverrides)
|
||||
export const isObjectMetadataSettingsReadOnly = ({
|
||||
objectPermissions,
|
||||
objectMetadataItem,
|
||||
}: IsObjectMetadataSettingsReadOnlyParams) => {
|
||||
return isObjectMetadataReadOnly({ objectPermissions, objectMetadataItem });
|
||||
};
|
||||
Reference in New Issue
Block a user