From f13294a397ea9b885a7dd505e9f9c5455d161046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Thu, 8 Nov 2018 11:20:22 +0100 Subject: [PATCH] Button - refactor for clarity --- .../src/components/post-publish-button/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/components/post-publish-button/index.js b/packages/editor/src/components/post-publish-button/index.js index c4049795555e9b..e5c1cf4eb3855e 100644 --- a/packages/editor/src/components/post-publish-button/index.js +++ b/packages/editor/src/components/post-publish-button/index.js @@ -42,9 +42,12 @@ export class PostPublishButton extends Component { forceIsDirty, forceIsSaving, } = this.props; - const isButtonEnabled = ( ! isSaving && ! forceIsSaving ) && - ( forceIsDirty || isPublishable ) && - ( isSaveable && ! isPostSavingLocked ); + const isButtonDisabled = + isSaving || + forceIsSaving || + ! isSaveable || + isPostSavingLocked || + ( ! isPublishable && ! forceIsDirty ); let publishStatus; if ( ! hasPublishAction ) { @@ -70,7 +73,7 @@ export class PostPublishButton extends Component { isPrimary isLarge onClick={ onClick } - disabled={ ! isButtonEnabled } + disabled={ isButtonDisabled } isBusy={ isSaving && isPublished } >