diff --git a/assets/src/gutenberg.js b/assets/src/gutenberg.js index b1a6c60c987d562152d0eb3c1b7f90380c6bf0d4..0e1949f527f4059dd8b37f719845335202e75cb5 100644 --- a/assets/src/gutenberg.js +++ b/assets/src/gutenberg.js @@ -16,7 +16,6 @@ const Render = ( { limit, manualPurge, showPurgeButton, updateMeta } ) => ( title={ __( 'WP Revisions Control', 'wp_revisions_control' ) } className={ slug } > - {/* TODO: switch to InputControl when it becomes available. */} <TextControl label={ __( 'Number of revisions to retain:', 'wp_revisions_control' ) } help={ __( 'Leave blank to keep all revisions.', 'wp_revisions_control' ) } @@ -36,17 +35,20 @@ const PurgeModal = ( limit, manualPurge ) => { closeModal(); manualPurge(); }; - - const modalText = sprintf( - /* translators: 1. Number of revisions to keep. */ - _n( - 'This will remove all but the most-recent revision.', - 'This will remove all but the %1$d most-recent revisions.', - parseInt( limit ), - 'wp_revisions_control' - ), - limit - ); + const parsedLimit = parseInt( limit, 10 ); + + const modalText = 0 === parsedLimit + ? __( 'This will remove all revisions.', 'wp_revisions_control' ) + : sprintf( + /* translators: 1. Number of revisions to keep. */ + _n( + 'This will remove all but the most-recent revision.', + 'This will remove all but the %1$d most-recent revisions.', + parsedLimit, + 'wp_revisions_control' + ), + limit + ); return ( <> @@ -64,13 +66,15 @@ const PurgeModal = ( limit, manualPurge ) => { { modalText } </p> - <Button isSecondary onClick={ closeModal }> - { __( 'Cancel', 'wp_revisions_control' ) } - </Button> - <Button isPrimary onClick={ closeModalAndPurge }> { __( 'Purge', 'wp_revisions_control' ) } </Button> + + + + <Button isSecondary onClick={ closeModal }> + { __( 'Cancel', 'wp_revisions_control' ) } + </Button> </Modal> ) } </>