Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion specifyweb/frontend/js_src/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const config: Config.InitialOptions = {
moduleNameMapper: {
'\\.(jpg|jpeg|png|webp|svg|ttf|webm)$':
'<rootDir>/lib/tests/__mocks__/fileMock.ts',
'^react-dom/server$': 'react-dom/server.node',
'^react-dom/server$': 'react-dom/server.node',
'\\.(css)$': '<rootDir>/lib/tests/__mocks__/styleFileMock.ts',
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ export function RecordSetAttachments<SCHEMA extends AnySchema>({

const isComplete = fetchedCount.current === recordCount;

const [showCreateRecordSetDialog, setShowCreateRecordSetDialog] = React.useState(false);
const [showCreateRecordSetDialog, setShowCreateRecordSetDialog] =
React.useState(false);

return (
<>
Expand All @@ -133,16 +134,17 @@ export function RecordSetAttachments<SCHEMA extends AnySchema>({
<Button.Info
title={attachmentsText.downloadAllDescription()}
onClick={(): void =>
(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()}
Expand All @@ -157,15 +159,15 @@ export function RecordSetAttachments<SCHEMA extends AnySchema>({
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}
>
Expand Down Expand Up @@ -215,13 +217,11 @@ function CreateRecordSetDialog({
}): JSX.Element {
return (
<Dialog
buttons={
<Button.DialogClose>{commonText.close()}</Button.DialogClose>
}
buttons={<Button.DialogClose>{commonText.close()}</Button.DialogClose>}
header={attachmentsText.downloadAll()}
onClose={onClose}
>
{attachmentsText.createRecordSetToDownloadAll()}
</Dialog>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -316,10 +320,7 @@ export class BusinessRuleManager<SCHEMA extends AnySchema> {
)
);

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export function initializeResource(resource: SpecifyResource<AnySchema>): 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);
Expand Down