Skip to content

Commit

Permalink
Release 3.4.2 (#870)
Browse files Browse the repository at this point in the history
* Replace some dev-workspace scripts with a make file

* Update the base image for dev-workspace

* Improve date preview in the Post Types settings, #840
Add currentTime to the output of the /settings/validate-expire-offset
API endpoint.

* Optimize requests in the date preview, #840

* Update compiled scripts

* Fix error messages in the post types settings, #841

* Update compiled scripts

* Update the changelog

* Fix user capabilities check in the block editor, #727
Improve checking in the other controllers.

* Update the changelog

* Update ES, FR, IT translations (#859)

* Bump version to 3.4.2-beta.3

* Compile js scripts for production

* Update compiled language files

* Update the changelog

* Update the test environment

* Restore old tests
Those tests still need to be reviewed and updated.

* Add the tests/.env.dist file

* Add test and codeception composer scripts

* Update PublishPress Future Pro banner text (#867)

* Bump version and stable tag to 3.4.2

* Add lang scripts

* Update pot file

* Update the release checklist on the issue templates
  • Loading branch information
andergmartins authored Jul 15, 2024
1 parent 745b42f commit 3707ce9
Show file tree
Hide file tree
Showing 118 changed files with 8,333 additions and 6,337 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/release-free-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ To release the Free plugin, ensure you complete all the tasks below.
### Release Checklist

- [ ] Update the version number to a stable version in the main plugin file and `readme.txt` as per [tech documentation](https://rambleventures.slab.com/posts/version-numbers-58nmrk4b), and commit to the release branch.
- [ ] If anything changed in the code after test package distribution, redo the pre-release checklist.
- [ ] Build the final zip package with `composer build`, creating a new package in the `./dist` directory.
- [ ] Create and merge a Pull Request for the release branch into the `main` branch.
- [ ] Merge the `main` branch into the `development` branch.
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/release-pro-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ To release the Pro plugin, ensure you complete all the tasks below.
### Release Checklist

- [ ] Update the version number to a stable version in the main plugin file and `readme.txt` as per [tech documentation](https://rambleventures.slab.com/posts/version-numbers-58nmrk4b), and commit to the release branch.
- [ ] If anything changed in the code after test package distribution, redo the pre-release checklist.
- [ ] Build the final zip package with `composer build`, creating a new package in the `./dist` directory.
- [ ] Create and merge a Pull Request for the release branch into the `main` branch.
- [ ] Merge the `main` branch into the `development` branch.
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ ray.php
/cache
/.cache
.phplint.cache*

/tests-*
/tests/.env
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [3.4.2] - 15 Jul, 2024

### Added

- Add the current date and time to date preview in the date/time offset setting field, #840

### Fixed

- Optimized the date/time offset validation requests in the Post Types settings, #840
- Fix error message in the date/time offset setting field, #841
- Fix user capabilities check in the block editor, #727
- Update ES, FR, and IT translations, #859

### Changed

- Change the text in the promo screen for the Actions Workflow feature, #867

## [3.4.1] - 02 Jul, 2024

### Added
Expand Down
14 changes: 14 additions & 0 deletions assets/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,17 @@ p.description,
margin: 0;
border-width: 3px;
}

/* Notices */
.publishpress-future-notice {
padding: 10px;
margin-bottom: 20px;
border-radius: 4px;
width: 100%;
}

.publishpress-future-notice-error {
background-color: #f2dede;
border-color: #deb2ba;
color: #a94442;
}
2 changes: 1 addition & 1 deletion assets/js/block-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/block-editor.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/bulk-edit.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/bulk-edit.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/classic-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/classic-editor.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/quick-edit.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/quick-edit.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/settings-post-types.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/settings-post-types.js.map

Large diffs are not rendered by default.

54 changes: 39 additions & 15 deletions assets/jsx/components/PostTypeSettingsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ import {
TokensControl,
CheckboxControl
} from './';
import { useEffect, useState, Fragment } from '@wordpress/element';
import { useEffect, useState, Fragment, useRef } from '@wordpress/element';
import { addQueryArgs } from '@wordpress/url';
import { applyFilters } from '@wordpress/hooks';
import { apiFetch } from '&wp';

const { PanelRow, BaseControl } = wp.components;

var apiRequestController = null;

export const PostTypeSettingsPanel = function (props) {
const originalExpireTypeList = props.expireTypeList[props.postType];

Expand All @@ -39,6 +37,8 @@ export const PostTypeSettingsPanel = function (props) {
const [newStatus, setNewStatus] = useState(props.settings.newStatus);
const [hasPendingValidation, setHasPendingValidation] = useState(false);
const [offsetPreview, setOffsetPreview] = useState('');
const [currentTime, setCurrentTime] = useState();
const apiRequestControllerRef = useRef(new AbortController());

const taxonomyRelatedActions = [
'category',
Expand Down Expand Up @@ -81,22 +81,27 @@ export const PostTypeSettingsPanel = function (props) {
return true;
}

if (expireOffset) {
if (apiRequestController) {
apiRequestController.abort();
const offset = expireOffset ? expireOffset : props.settings.globalDefaultExpireOffset;

if (offset) {
const controller = apiRequestControllerRef.current;

if (controller) {
controller.abort();
}

apiRequestController = typeof AbortController === 'undefined' ? undefined : new AbortController();
const signal = apiRequestController ? apiRequestController.signal : undefined;
apiRequestControllerRef.current = new AbortController();
const { signal } = apiRequestControllerRef.current;

setHasPendingValidation(true);

apiFetch({
path: addQueryArgs(`publishpress-future/v1/settings/validate-expire-offset`),
method: 'POST',
data: {
offset: expireOffset
offset
},
signal: signal
signal,
}).then((result) => {
setHasPendingValidation(false);

Expand All @@ -105,9 +110,19 @@ export const PostTypeSettingsPanel = function (props) {

if (result.isValid) {
setOffsetPreview(result.preview);
setCurrentTime(result.currentTime);
} else {
setOffsetPreview('');
}
}).catch((error) => {
if (error.name === 'AbortError') {
return;
}

setHasPendingValidation(false);
setHasValidData(false);
setValidationError(error.message);
setOffsetPreview('');
});
}

Expand Down Expand Up @@ -169,7 +184,7 @@ export const PostTypeSettingsPanel = function (props) {

useEffect(() => {
setHasValidData(validateData());
}, [isActive, postTypeTaxonomy, selectedTerms, settingHowToExpire, taxonomyLabel, expireOffset]);
}, [isActive, expireOffset]);

useEffect(() => {
if (!taxonomyLabel) {
Expand Down Expand Up @@ -307,7 +322,16 @@ export const PostTypeSettingsPanel = function (props) {
{offsetPreview && (
<Fragment>
<h4>{props.text.datePreview}</h4>
<code>{offsetPreview}</code>
<div>
<div>
<span>{props.text.datePreviewCurrent}: </span>
<span><code>{currentTime}</code></span>
</div>
<div>
<span>{props.text.datePreviewComputed}: </span>
<span><code>{offsetPreview}</code></span>
</div>
</div>
</Fragment>
)}
</SettingRow>
Expand All @@ -334,9 +358,9 @@ export const PostTypeSettingsPanel = function (props) {

{! hasValidData && (
<PanelRow>
<BaseControl className="notice notice-error">
<div>{validationError}</div>
</BaseControl>
<div className="publishpress-future-notice publishpress-future-notice-error">
<strong>{props.text.error}:</strong> {validationError}
</div>
</PanelRow>
)}
</SettingsFieldset>
Expand Down
19 changes: 4 additions & 15 deletions codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,16 @@ extensions:
enabled:
- Codeception\Extension\RunFailed
- lucatume\WPBrowser\Extension\ChromeDriverController
- lucatume\WPBrowser\Extension\BuiltInServerController
config:
lucatume\WPBrowser\Extension\ChromeDriverController:
port: '%CHROMEDRIVER_PORT%'
lucatume\WPBrowser\Extension\BuiltInServerController:
workers: 5
port: '%BUILTIN_SERVER_PORT%'
docroot: '%WORDPRESS_ROOT_DIR%'
env:
DATABASE_TYPE: sqlite
DB_ENGINE: sqlite
DB_DIR: '%codecept_root_dir%/tests/Support/Data'
DB_FILE: db.sqlite
binary: '%CHROMEDRIVER_BINARY%'
suites: ['EndToEnd']
commands:
- lucatume\WPBrowser\Command\RunOriginal
- lucatume\WPBrowser\Command\RunAll
- lucatume\WPBrowser\Command\GenerateWPUnit
- lucatume\WPBrowser\Command\DbExport
- lucatume\WPBrowser\Command\DbImport
- lucatume\WPBrowser\Command\DevStart
- lucatume\WPBrowser\Command\DevStop
- lucatume\WPBrowser\Command\DevInfo
- lucatume\WPBrowser\Command\DevRestart
- lucatume\WPBrowser\Command\ChromedriverUpdate
- lucatume\WPBrowser\Command\MonkeyCachePath
- lucatume\WPBrowser\Command\MonkeyCacheClear
154 changes: 117 additions & 37 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"squizlabs/php_codesniffer": "^3.8",
"overtrue/phplint": "^9.1",
"wp-cli/i18n-command": "^2.6",
"wp-cli/wp-cli-bundle": "^2.10",
"friendsofphp/php-cs-fixer": "^3.49",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.3",
Expand All @@ -78,54 +79,133 @@
"profile:js": "webpack --profile --json > webpack-bundle-stats.json",
"watch:js": "wp-scripts build --mode development --watch",
"get:version": "pbuild version",
"gen:pot-php": "wp i18n make-pot . ./languages/post-expirator.pot --domain=post-expirator --exclude=dev-workspace,.wordpress-org,.github,dist,tests,lib,tmp,doc,*.js,*.js.map,*.jsx --allow-root",
"gen:pot-js": "bash ./dev-workspace/scripts/lang-make-js-pot.sh",
"gen:mo": "wp i18n make-mo ./languages ./languages --allow-root",
"gen:pot": "wp i18n make-pot . languages/post-expirator.pot --domain=post-expirator --exclude=dev-workspace,.wordpress-org,.github,dist,tests, --allow-root",
"gen:po-scripts": "bash ./dev-workspace/scripts/lang-update-js-po.sh",
"gen:po-json": "bash ./dev-workspace/scripts/lang-make-json.sh",
"gen:pot": [
"@gen:pot-php",
"@gen:pot-js"
],
"gen:lang": [
"@gen:pot",
"@gen:mo"
"@gen:mo",
"@gen:po-scripts",
"@gen:po-json",
"@cleanup:js-mo"
],
"cleanup:js-mo": "bash ./dev-workspace/scripts/lang-cleanup.sh",
"cleanup:gh-workflows": "user=publishpress repo=publishpress-future; gh api repos/$user/$repo/actions/runs --paginate -q '.workflow_runs[] | select(.head_branch != \"master\") | \"\\(.id)\"' | xargs -n1 -I % gh api --silent repos/$user/$repo/actions/runs/% -X DELETE",
"dbox:up": "pdropbox upload && pdropbox share",
"dbox:list": "pdropbox list",
"dbox:remove": "pdropbox remove",
"dbox:unlink": "pdropbox unlink",
"check": [
"@build:dir",
"@check:lint",
"@check:php",
"@check:phpcs"
"check:php": [
"@check:php-5.6",
"@check:php-7.2",
"@check:php-7.4",
"@check:php-8.0",
"@check:php-8.1",
"@check:php-8.2",
"@check:php-8.3"
],
"check:longpath": "longpath .",
"check:php-5.6": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 5.6 ./publishpress-future-pro.php",
"check:php-7.2": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.2",
"check:php-7.4": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.4",
"check:php-8.0": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.0",
"check:php-8.1": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.1",
"check:php-8.2": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.2",
"check:php-8.3": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.3",
"check:lint": "phplint",
"check:phpcs": "phpcs",
"check:cs": "phpcs",
"check:stan": "phpstan",
"check:php": [
"@check:php56",
"@check:php72",
"@check:php74",
"@check:php80",
"@check:php81",
"@check:php82",
"@check:php83"
"check:longpath": "longpath .",
"fix:cs": "phpcbf --standard=.phpcs.xml",
"fix:php": [
"php-cs-fixer fix .",
"@fix:cs"
],
"check:php56": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 5.6 ./post-expirator.php",
"check:php72": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.2",
"check:php74": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 7.4",
"check:php80": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.0",
"check:php81": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.1",
"check:php82": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.2",
"check:php83": "phpcs --standard=.phpcs-php-compatibility.xml --runtime-set testVersion 8.3",
"tests:dev-start": "./vendor/bin/codecept dev:start",
"tests:dev-stop": "./vendor/bin/codecept dev:stop",
"tests:dev-restart": "./vendor/bin/codecept dev:restart",
"tests:cd-update": "./vendor/bin/codecept chromedriver:update",
"tests:import-db": "rm -rf ./tests/_wordpress/data && mkdir ./tests/_wordpress/data && vendor/bin/codecept wp:db:import ./tests/_wordpress ./tests/Support/Data/dump.sql",
"tests:run": "./vendor/bin/codecept run",
"dbox:up": "pdropbox upload && pdropbox share",
"dbox:list": "pdropbox list",
"dbox:remove": "pdropbox remove",
"dbox:unlink": "pdropbox unlink",
"tests:wp": "source ./tests/.env && wp --path=\"$WORDPRESS_ROOT_DIR\" \"$@\"",
"tests:clean": "vendor/bin/codecept clean",
"tests:link": "source ./tests/.env && if [ ! -L \"$WORDPRESS_ROOT_DIR/wp-content/plugins/$PLUGIN_SLUG\" ]; then ln -s \"$PWD\" \"$WORDPRESS_ROOT_DIR/wp-content/plugins/$PLUGIN_SLUG\"; fi",
"tests:activate": "source ./tests/.env && wp --path=\"$WORDPRESS_ROOT_DIR\" plugin activate $PLUGIN_SLUG/${PLUGIN_SLUG}.php",
"tests:db-export": "source ./tests/.env && wp --path=\"$WORDPRESS_ROOT_DIR\" db export ./tests/Support/Data/dump.sql",
"tests:db-import": "source ./tests/.env && wp --path=\"$WORDPRESS_ROOT_DIR\" db import ./tests/Support/Data/dump.sql",
"tests:chromedriver": "source ./tests/.env && $CHROMEDRIVER_BINARY --port=$CHROMEDRIVER_PORT",
"tests:all": "./vendor/bin/codecept run",
"tests:integration": "./vendor/bin/codecept run Integration",
"tests:e2e": "./vendor/bin/codecept run EndToEnd",
"pre-autoload-dump": "composer dumpautoload --working-dir=./lib",
"pre-update-cmd": "composer update --working-dir=./lib",
"pre-install-cmd": "composer install --working-dir=./lib"
"tests:unit": "./vendor/bin/codecept run Unit",
"test": "./vendor/bin/codecept run $@",
"codeception": "./vendor/bin/codecept $@",
"docker:cleanup": "docker system prune -f",
"config:phpcs": "phpcs --config-set installed_paths \"../../phpcsstandards/phpcsutils,../../phpcsstandards/phpcsextra,../../automattic/vipwpcs,../../phpcompatibility/php-compatibility,../../sirbrillig/phpcs-variable-analysis,../../publishpress/publishpress-phpcs-standards/standards,../../wp-coding-standards/wpcs\"",
"post-install-cmd": [
"@config:phpcs"
],
"post-update-cmd": [
"@config:phpcs"
],
"pre-autoload-dump": "@composer dumpautoload --working-dir=./lib",
"pre-update-cmd": "@composer update --working-dir=./lib",
"pre-install-cmd": "@composer install --working-dir=./lib"
},
"scripts-descriptions": {
"build": "Builds the plugin.",
"build:up": "Builds the plugin and uploads it to Dropbox.",
"build:dir": "Builds the plugin in a directory.",
"build:clean": "Cleans up the build directory.",
"build:js-dev": "Builds the JavaScript files in development mode.",
"build:js": "Builds the JavaScript files in production mode.",
"profile:js": "Generates a profile of the JavaScript build.",
"watch:js": "Watches the JavaScript files for changes.",
"get:version": "Gets the version of the plugin.",
"gen:pot-php": "Generates the PHP POT file for translations.",
"gen:pot-js": "Generates the JavaScript POT file for translations.",
"gen:mo": "Generates the MO files for translations.",
"gen:po-scripts": "Updates the JavaScript PO files for translations.",
"gen:po-json": "Generates the JSON files for translations.",
"gen:pot": "Generates the POT files for translations.",
"gen:lang": "Generates the language files for translations.",
"cleanup:js-mo": "Cleans up the JavaScript MO files.",
"cleanup:gh-workflows": "Cleans up the GitHub workflows.",
"gen:alias-plugin": "Generates the alias plugin file.",
"check:php": "Checks the PHP compatibility for all versions.",
"check:php-5.6": "Checks the PHP compatibility for PHP 5.6 in the main file only.",
"check:php-7.2": "Checks the PHP compatibility for PHP 7.2.",
"check:php-7.4": "Checks the PHP compatibility for PHP 7.4.",
"check:php-8.0": "Checks the PHP compatibility for PHP 8.0.",
"check:php-8.1": "Checks the PHP compatibility for PHP 8.1.",
"check:php-8.2": "Checks the PHP compatibility for PHP 8.2.",
"check:php-8.3": "Checks the PHP compatibility for PHP 8.3.",
"check:lint": "Checks the PHP files for syntax errors.",
"check:cs": "Checks the PHP files for coding standards.",
"check:stan": "Checks the PHP files for static analysis.",
"check:longpath": "Checks the PHP files for long paths.",
"check:deps": "Checks the dependencies.",
"fix:deps": "Fixes the dependencies.",
"fix:cs": "Fixes the PHP files for coding standards.",
"fix:php": "Fixes the PHP files.",
"dbox:up": "Uploads the built package to Dropbox and generates a sharable URL.",
"dbox:list": "Lists the package in Dropbox.",
"dbox:remove": "Removes the built package from Dropbox.",
"dbox:unlink": "Unlinks the Dropbox account.",
"tests:wp": "Runs WP-CLI commands within the context of the test environment.",
"tests:clean": "Cleans up the Codeception cache and generated files.",
"tests:link": "Creates a symbolic link of the plugin directory in the WordPress installation for testing.",
"tests:activate": "Activates the plugin within the WordPress test environment using WP-CLI.",
"tests:db-export": "Exports the WordPress database to a SQL file.",
"tests:db-import": "Imports a SQL file into the WordPress test database.",
"tests:chromedriver": "Starts the ChromeDriver server.",
"tests:all": "Runs all the tests defined in Codeception.",
"tests:integration": "Runs the integration tests.",
"tests:e2e": "Run the end-to-end tests.",
"tests:unit": "Run the unit tests.",
"test": "Runs tests with custom arguments or specific files.",
"codeception": "Runs Codeception commands.",
"docker:cleanup": "Cleans up the Docker system.",
"config:phpcs": "Configures the PHP CodeSniffer installed paths."
},
"extra": {
"plugin-slug": "post-expirator",
Expand Down
Loading

0 comments on commit 3707ce9

Please sign in to comment.