Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant check for open forms #1036

Merged
merged 1 commit into from Oct 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -28,8 +28,7 @@ import {
import {
selectIsCollectionOpen,
editorCloseCollections,
selectHasMultipleFrontsOpen,
createSelectDoesCollectionHaveOpenForms
selectHasMultipleFrontsOpen
} from 'bundles/frontsUIBundle';
import { getArticlesForCollections } from 'actions/Collections';
import { collectionItemSets } from 'constants/fronts';
Expand Down Expand Up @@ -64,7 +63,6 @@ type CollectionProps = CollectionPropsBeforeState & {
previousGroup: Group;
displayEditWarning: boolean;
isCollectionLocked: boolean;
isEditFormOpen: boolean;
isOpen: boolean;
hasContent: boolean;
hasMultipleFrontsOpen: boolean;
Expand Down Expand Up @@ -164,7 +162,6 @@ class Collection extends React.Component<CollectionProps> {
isOpen,
onChangeOpenState,
hasMultipleFrontsOpen,
isEditFormOpen,
discardDraftChangesToCollection: discardDraftChanges,
hasPrefill,
isHidden,
Expand All @@ -188,8 +185,7 @@ class Collection extends React.Component<CollectionProps> {
onChangeOpenState={() => onChangeOpenState(id, isOpen)}
headlineContent={
hasUnpublishedChanges &&
canPublish &&
!isEditFormOpen && (
canPublish && (
<Fragment>
<EditModeVisibility visibleMode="editions">
<Button
Expand Down Expand Up @@ -219,11 +215,6 @@ class Collection extends React.Component<CollectionProps> {
onClick={() => discardDraftChanges(id)}
tabIndex={-1}
data-testid="collection-discard-button"
title={
isEditFormOpen
? 'You cannot discard changes to this collection whilst the edit form is open.'
: undefined
}
>
Discard
</Button>
Expand All @@ -233,11 +224,6 @@ class Collection extends React.Component<CollectionProps> {
onClick={() => this.startPublish(id, frontId)}
tabIndex={-1}
disabled={isLaunching}
title={
isEditFormOpen
? 'You cannot launch this collection whilst the edit form is open.'
: undefined
}
>
{isLaunching ? (
<LoadingImageBox>
Expand Down Expand Up @@ -303,31 +289,27 @@ const createMapStateToProps = () => {
priority,
frontId
}: CollectionPropsBeforeState
) => {
const selectDoesCollectionHaveOpenForms = createSelectDoesCollectionHaveOpenForms();
return {
isHidden: selectCollectionIsHidden(state, collectionId),
hasPrefill: selectCollectionHasPrefill(state, collectionId),
hasUnpublishedChanges: selectHasUnpublishedChanges(state, {
collectionId
}),
isCollectionLocked: selectIsCollectionLocked(state, collectionId),
groups: selectCollectionStageGroups(selectSharedState(state), {
collectionSet: browsingStage,
collectionId
}),
previousGroup: selectPreviously(selectSharedState(state), {
collectionId
}),
displayEditWarning: selectEditWarning(selectSharedState(state), {
collectionId
}),
isOpen: selectIsCollectionOpen(state, collectionId),
hasMultipleFrontsOpen: selectHasMultipleFrontsOpen(state, priority),
isEditFormOpen: selectDoesCollectionHaveOpenForms(state, collectionId),
hasContent: !!selectors.selectById(selectSharedState(state), collectionId)
};
};
) => ({
isHidden: selectCollectionIsHidden(state, collectionId),
hasPrefill: selectCollectionHasPrefill(state, collectionId),
hasUnpublishedChanges: selectHasUnpublishedChanges(state, {
collectionId
}),
isCollectionLocked: selectIsCollectionLocked(state, collectionId),
groups: selectCollectionStageGroups(selectSharedState(state), {
collectionSet: browsingStage,
collectionId
}),
previousGroup: selectPreviously(selectSharedState(state), {
collectionId
}),
displayEditWarning: selectEditWarning(selectSharedState(state), {
collectionId
}),
isOpen: selectIsCollectionOpen(state, collectionId),
hasMultipleFrontsOpen: selectHasMultipleFrontsOpen(state, priority),
hasContent: !!selectors.selectById(selectSharedState(state), collectionId)
});
};

const mapDispatchToProps = (
Expand Down