mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
[TLC-674] Properly test for existence of duplicates section
This commit is contained in:
@@ -76,8 +76,6 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
|
||||
*/
|
||||
showThumbnails: boolean;
|
||||
|
||||
enableDetectDuplicates$: Observable<any>;
|
||||
|
||||
constructor(
|
||||
protected linkService: LinkService,
|
||||
protected truncatableService: TruncatableService,
|
||||
@@ -101,14 +99,6 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
|
||||
followLink('submitter')
|
||||
), followLink('action'));
|
||||
|
||||
// Get configuration for duplicate detection feature
|
||||
this.enableDetectDuplicates$ = this.configService.findByPropertyName('duplicate.enable').pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((rd: RemoteData<ConfigurationProperty>) => {
|
||||
return (rd.hasSucceeded && rd.payload && rd.payload.values[0] === 'true');
|
||||
})
|
||||
);
|
||||
|
||||
(this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
mergeMap((wfiRD: RemoteData<WorkflowItem>) => {
|
||||
|
@@ -449,7 +449,7 @@ export class SubmissionObjectEffects {
|
||||
// or if configuration overrides this behaviour
|
||||
if (!alwaysDisplayDuplicates()) {
|
||||
const duplicatesSectionId = findKey(currentState.sections, (section) => section.sectionType === SectionsType.Duplicates);
|
||||
if (isNotUndefined(duplicatesSectionId) && isEmpty((sections[duplicatesSectionId] as WorkspaceitemSectionDuplicatesObject).potentialDuplicates)) {
|
||||
if (isNotUndefined(duplicatesSectionId) && sections.hasOwnProperty(duplicatesSectionId) && isEmpty((sections[duplicatesSectionId] as WorkspaceitemSectionDuplicatesObject).potentialDuplicates)) {
|
||||
mappedActions.push(new CleanDuplicateDetectionAction(submissionId));
|
||||
}
|
||||
}
|
||||
|
@@ -862,7 +862,7 @@ function deleteFile(state: SubmissionObjectState, action: DeleteUploadedFileActi
|
||||
}
|
||||
|
||||
function cleanDuplicateDetectionSection(state: SubmissionObjectState, action: CleanDuplicateDetectionAction): SubmissionObjectState {
|
||||
if (isNotEmpty(state[ action.payload.submissionId ])) {
|
||||
if (isNotEmpty(state[ action.payload.submissionId ]) && state[action.payload.submissionId].sections.hasOwnProperty('duplicates')) {
|
||||
return Object.assign({}, state, {
|
||||
[ action.payload.submissionId ]: Object.assign({}, state[ action.payload.submissionId ], {
|
||||
sections: Object.assign({}, state[ action.payload.submissionId ].sections, {
|
||||
|
Reference in New Issue
Block a user