diff --git a/specifyweb/frontend/js_src/jest.config.ts b/specifyweb/frontend/js_src/jest.config.ts index 463ea58f7e9..973afa837bc 100644 --- a/specifyweb/frontend/js_src/jest.config.ts +++ b/specifyweb/frontend/js_src/jest.config.ts @@ -115,7 +115,7 @@ const config: Config.InitialOptions = { moduleNameMapper: { '\\.(jpg|jpeg|png|webp|svg|ttf|webm)$': '/lib/tests/__mocks__/fileMock.ts', - '^react-dom/server$': 'react-dom/server.node', + '^react-dom/server$': 'react-dom/server.node', '\\.(css)$': '/lib/tests/__mocks__/styleFileMock.ts', }, diff --git a/specifyweb/frontend/js_src/lib/components/Attachments/RecordSetAttachment.tsx b/specifyweb/frontend/js_src/lib/components/Attachments/RecordSetAttachment.tsx index 597e4ed3665..c41f2c2da3e 100644 --- a/specifyweb/frontend/js_src/lib/components/Attachments/RecordSetAttachment.tsx +++ b/specifyweb/frontend/js_src/lib/components/Attachments/RecordSetAttachment.tsx @@ -109,7 +109,8 @@ export function RecordSetAttachments({ const isComplete = fetchedCount.current === recordCount; - const [showCreateRecordSetDialog, setShowCreateRecordSetDialog] = React.useState(false); + const [showCreateRecordSetDialog, setShowCreateRecordSetDialog] = + React.useState(false); return ( <> @@ -133,16 +134,17 @@ export function RecordSetAttachments({ - (recordSetId === undefined && !isComplete) ? - setShowCreateRecordSetDialog(true) - : - loading( - downloadAllAttachments( - (recordSetId !== undefined && !isComplete) ? [] : attachmentsRef.current?.attachments ?? [], - name, - recordSetId, - ) - ) + recordSetId === undefined && !isComplete + ? setShowCreateRecordSetDialog(true) + : loading( + downloadAllAttachments( + recordSetId !== undefined && !isComplete + ? [] + : (attachmentsRef.current?.attachments ?? []), + name, + recordSetId + ) + ) } > {attachmentsText.downloadAll()} @@ -157,15 +159,15 @@ export function RecordSetAttachments({ header={ attachmentsRef.current?.attachments === undefined ? attachmentsText.attachments() - : (isComplete ? - commonText.countLine({ - resource: attachmentsText.attachments(), - count: attachmentsRef.current.attachments.length - }) : - commonText.countLineOrMore({ - resource: attachmentsText.attachments(), - count: attachmentsRef.current.attachments.length - })) + : isComplete + ? commonText.countLine({ + resource: attachmentsText.attachments(), + count: attachmentsRef.current.attachments.length, + }) + : commonText.countLineOrMore({ + resource: attachmentsText.attachments(), + count: attachmentsRef.current.attachments.length, + }) } onClose={handleHideAttachments} > @@ -215,13 +217,11 @@ function CreateRecordSetDialog({ }): JSX.Element { return ( {commonText.close()} - } + buttons={{commonText.close()}} header={attachmentsText.downloadAll()} onClose={onClose} > {attachmentsText.createRecordSetToDownloadAll()} ); -} \ No newline at end of file +} diff --git a/specifyweb/frontend/js_src/lib/components/BatchEdit/index.tsx b/specifyweb/frontend/js_src/lib/components/BatchEdit/index.tsx index 31b410f3be4..59cb682763b 100644 --- a/specifyweb/frontend/js_src/lib/components/BatchEdit/index.tsx +++ b/specifyweb/frontend/js_src/lib/components/BatchEdit/index.tsx @@ -247,7 +247,6 @@ const containsSystemTables = (queryFieldSpec: QueryFieldSpec) => { return Boolean(baseIsBlocked || pathHasBlockedSystem); }; - const hasHierarchyBaseTable = (queryFieldSpec: QueryFieldSpec) => Object.keys(schema.domainLevelIds).includes( queryFieldSpec.baseTable.name.toLowerCase() as 'collection' diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/businessRules.ts b/specifyweb/frontend/js_src/lib/components/DataModel/businessRules.ts index f7581eb2b30..868b11dac2a 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/businessRules.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/businessRules.ts @@ -7,7 +7,11 @@ import { softFail } from '../Errors/Crash'; import { isTreeResource } from '../InitialContext/treeRanks'; import type { BusinessRuleDefs } from './businessRuleDefs'; import { businessRuleDefs } from './businessRuleDefs'; -import { backboneFieldSeparator, backendFilter, djangoLookupSeparator } from './helpers'; +import { + backboneFieldSeparator, + backendFilter, + djangoLookupSeparator, +} from './helpers'; import type { AnySchema, AnyTree, @@ -316,10 +320,7 @@ export class BusinessRuleManager { ) ); - const stringValuesAreEqual = ( - left: string, - right: string - ): boolean => + const stringValuesAreEqual = (left: string, right: string): boolean => rule.isDatabaseConstraint ? left.localeCompare(right, undefined, { sensitivity: 'accent' }) === 0 : left === right; diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/scoping.ts b/specifyweb/frontend/js_src/lib/components/DataModel/scoping.ts index 4567020566c..a67e8423a79 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/scoping.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/scoping.ts @@ -39,7 +39,9 @@ export function initializeResource(resource: SpecifyResource): void { if ( getCollectionPref('CO_CREATE_COA', schema.domainLevelIds.collection) && - hasTablePermission('CollectionObjectAttribute', 'create') + hasTablePermission('CollectionObjectAttribute', 'create') && + resource.createdBy !== 'clone' && + collectionObject.get('collectionObjectAttribute') == null ) { const attribute = new tables.CollectionObjectAttribute.Resource(); attribute.placeInSameHierarchy(collectionObject);