mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +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;
|
showThumbnails: boolean;
|
||||||
|
|
||||||
enableDetectDuplicates$: Observable<any>;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected linkService: LinkService,
|
protected linkService: LinkService,
|
||||||
protected truncatableService: TruncatableService,
|
protected truncatableService: TruncatableService,
|
||||||
@@ -101,14 +99,6 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
|
|||||||
followLink('submitter')
|
followLink('submitter')
|
||||||
), followLink('action'));
|
), 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(
|
(this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
mergeMap((wfiRD: RemoteData<WorkflowItem>) => {
|
mergeMap((wfiRD: RemoteData<WorkflowItem>) => {
|
||||||
|
@@ -449,7 +449,7 @@ export class SubmissionObjectEffects {
|
|||||||
// or if configuration overrides this behaviour
|
// or if configuration overrides this behaviour
|
||||||
if (!alwaysDisplayDuplicates()) {
|
if (!alwaysDisplayDuplicates()) {
|
||||||
const duplicatesSectionId = findKey(currentState.sections, (section) => section.sectionType === SectionsType.Duplicates);
|
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));
|
mappedActions.push(new CleanDuplicateDetectionAction(submissionId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -862,7 +862,7 @@ function deleteFile(state: SubmissionObjectState, action: DeleteUploadedFileActi
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanDuplicateDetectionSection(state: SubmissionObjectState, action: CleanDuplicateDetectionAction): SubmissionObjectState {
|
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, {
|
return Object.assign({}, state, {
|
||||||
[ action.payload.submissionId ]: Object.assign({}, state[ action.payload.submissionId ], {
|
[ action.payload.submissionId ]: Object.assign({}, state[ action.payload.submissionId ], {
|
||||||
sections: Object.assign({}, state[ action.payload.submissionId ].sections, {
|
sections: Object.assign({}, state[ action.payload.submissionId ].sections, {
|
||||||
|
Reference in New Issue
Block a user