From 409de05cad9676ae86ad363cd6b295036cdf2cd2 Mon Sep 17 00:00:00 2001 From: Eric Rosas Date: Thu, 27 Jun 2024 15:21:07 -0700 Subject: [PATCH 1/4] Updated Craft to `v4.10.2` Updated Craft to `v4.10.2` --- api/composer.json | 4 ++-- api/composer.lock | 40 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/api/composer.json b/api/composer.json index 542dd951..b742c33b 100755 --- a/api/composer.json +++ b/api/composer.json @@ -2,7 +2,7 @@ "require": { "carlcs/craft-assetmetadata": "^4.0", "castiron/next-builds": "^1.1", - "craftcms/cms": "4.8.4", + "craftcms/cms": "4.10.2", "craftcms/contact-form": "3.1.0", "craftcms/contact-form-honeypot": "2.1.0", "craftcms/google-cloud": "2.1.0", @@ -64,4 +64,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} +} \ No newline at end of file diff --git a/api/composer.lock b/api/composer.lock index dbd5763f..6c061692 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d37096f1fd9460c7493c57518a5ff644", + "content-hash": "e533b183531a9ea28c56bf3fd8fb5080", "packages": [ { "name": "abraham/twitteroauth", @@ -682,11 +682,11 @@ }, { "name": "craftcms/cms", - "version": "4.8.4", + "version": "4.10.2", "dist": { "type": "zip", - "url": "https://api.github.com/repos/craftcms/cms/zipball/9d218d94f490e787e1c9f20ed9d2bd909a3bdfd2", - "reference": "9d218d94f490e787e1c9f20ed9d2bd909a3bdfd2", + "url": "https://api.github.com/repos/craftcms/cms/zipball/81cd6ce9cf28ec64bf3e3318a7e0eda46279cb28", + "reference": "81cd6ce9cf28ec64bf3e3318a7e0eda46279cb28", "shasum": "" }, "require": { @@ -723,7 +723,7 @@ "twig/twig": "~3.8.0", "voku/stringy": "^6.4.0", "webonyx/graphql-php": "~14.11.5", - "yiisoft/yii2": "~2.0.48.1", + "yiisoft/yii2": "~2.0.50", "yiisoft/yii2-debug": "~2.1.22.0", "yiisoft/yii2-queue": "~2.3.2", "yiisoft/yii2-symfonymailer": "^2.0.0" @@ -732,10 +732,10 @@ "webonyx/graphql-php": "14.11.7" }, "provide": { - "bower-asset/inputmask": "~3.2.2|~3.3.5", - "bower-asset/jquery": "3.5.*@stable|3.4.*@stable|3.3.*@stable|3.2.*@stable|3.1.*@stable|2.2.*@stable|2.1.*@stable|1.11.*@stable|1.12.*@stable", - "bower-asset/punycode": "1.3.*", - "bower-asset/yii2-pjax": "~2.0.1", + "bower-asset/inputmask": "5.0.9", + "bower-asset/jquery": "3.6.1", + "bower-asset/punycode": "2.3.1", + "bower-asset/yii2-pjax": "2.0.8", "yii2tech/ar-softdelete": "1.0.4" }, "suggest": { @@ -774,7 +774,7 @@ "docs": "https://craftcms.com/docs/4.x/", "rss": "https://github.com/craftcms/cms/releases.atom" }, - "time": "2024-03-19T17:13:27+00:00" + "time": "2024-06-18T22:11:04+00:00" }, { "name": "craftcms/contact-form", @@ -6948,25 +6948,25 @@ }, { "name": "yiisoft/yii2", - "version": "2.0.48.1", + "version": "2.0.50", "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/de92f154eefe322fc1b1b2a52cce46677441ced4", - "reference": "de92f154eefe322fc1b1b2a52cce46677441ced4", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/a90b6638cce84e78ed8f681a5cad4a14c76464b4", + "reference": "a90b6638cce84e78ed8f681a5cad4a14c76464b4", "shasum": "" }, "require": { - "bower-asset/inputmask": "~3.2.2 | ~3.3.5", - "bower-asset/jquery": "3.6.*@stable | 3.5.*@stable | 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", - "bower-asset/punycode": "1.3.*", + "bower-asset/inputmask": "^5.0.8 ", + "bower-asset/jquery": "3.7.*@stable | 3.6.*@stable | 3.5.*@stable | 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", + "bower-asset/punycode": "^2.2", "bower-asset/yii2-pjax": "~2.0.1", "cebe/markdown": "~1.0.0 | ~1.1.0 | ~1.2.0", "ext-ctype": "*", "ext-mbstring": "*", - "ezyang/htmlpurifier": "^4.6", + "ezyang/htmlpurifier": "^4.17", "lib-pcre": "*", "paragonie/random_compat": ">=1", - "php": ">=5.4.0", + "php": ">=7.3.0", "yiisoft/yii2-composer": "~2.0.4" }, "bin": [ @@ -7039,7 +7039,7 @@ "framework", "yii2" ], - "time": "2023-05-24T19:04:02+00:00" + "time": "2024-05-30T17:23:31+00:00" }, { "name": "yiisoft/yii2-composer", @@ -7478,5 +7478,5 @@ "platform-overrides": { "php": "8.1.10" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.6.0" } From 723b8c41c27874695e41fcf4cbf1257fb735e610 Mon Sep 17 00:00:00 2001 From: Eric Rosas Date: Mon, 1 Jul 2024 12:13:04 -0700 Subject: [PATCH 2/4] `Nextbuilds` now sends navigation tag for pages `Nextbuilds` plugin now sends `navigation` tag query param for pages --- api/composer.json | 2 +- api/composer.lock | 6 +++--- api/plugins/nextbuilds/CHANGELOG.md | 4 ++++ api/plugins/nextbuilds/composer.json | 2 +- api/plugins/nextbuilds/src/NextBuilds.php | 7 +++++-- api/plugins/nextbuilds/src/services/Request.php | 7 +++++-- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/api/composer.json b/api/composer.json index b742c33b..4fd604ce 100755 --- a/api/composer.json +++ b/api/composer.json @@ -64,4 +64,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} diff --git a/api/composer.lock b/api/composer.lock index 6c061692..2e6ea5a3 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -145,11 +145,11 @@ }, { "name": "castiron/next-builds", - "version": "1.1.1", + "version": "1.1.2", "dist": { "type": "path", "url": "plugins/nextbuilds", - "reference": "aee9a25507ccc0e1bfb61a07176ecc3d585dcc40" + "reference": "eb9b4bc2be5537134036dbdf3ca84ad2e5cbeb77" }, "require": { "craftcms/cms": "^4.0.0" @@ -7478,5 +7478,5 @@ "platform-overrides": { "php": "8.1.10" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.1.0" } diff --git a/api/plugins/nextbuilds/CHANGELOG.md b/api/plugins/nextbuilds/CHANGELOG.md index ecdd240e..c280cd7b 100755 --- a/api/plugins/nextbuilds/CHANGELOG.md +++ b/api/plugins/nextbuilds/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.1.2 - 2024-6-28 +### Fixed +- When a page is updated (enabled, disabled, deleted) the appropriate query param is sent to revalidate the navigation menu in the client + ## 1.1.1 - 2024-6-27 ### Fixed - Revalidate request is now firing after entry-save event trigger completes DB update diff --git a/api/plugins/nextbuilds/composer.json b/api/plugins/nextbuilds/composer.json index 24619aaa..689c3155 100755 --- a/api/plugins/nextbuilds/composer.json +++ b/api/plugins/nextbuilds/composer.json @@ -2,7 +2,7 @@ "name": "castiron/next-builds", "description": "Start Next.js page builds from Craft.", "type": "craft-plugin", - "version": "1.1.1", + "version": "1.1.2", "keywords": [ "craft", "cms", diff --git a/api/plugins/nextbuilds/src/NextBuilds.php b/api/plugins/nextbuilds/src/NextBuilds.php index f77b8b2e..328ec598 100755 --- a/api/plugins/nextbuilds/src/NextBuilds.php +++ b/api/plugins/nextbuilds/src/NextBuilds.php @@ -106,6 +106,7 @@ function (PluginEvent $event) { Entry::EVENT_AFTER_SAVE, function (ModelEvent $event) { $entry = $event->sender; + if ( $this->settings->activeSections[$entry->section->handle] && !ElementHelper::isDraftOrRevision($entry) && @@ -113,8 +114,9 @@ function (ModelEvent $event) { !ElementHelper::rootElement($entry)->isProvisionalDraft && !$entry->resaving ) { - Craft::$app->onAfterRequest(function() use ($entry) { - $this->request->buildPagesFromEntry($entry); + $revalidateMenu = ($entry->type->handle == "pages"); + Craft::$app->onAfterRequest(function() use ($entry, $revalidateMenu) { + $this->request->buildPagesFromEntry($entry, $revalidateMenu); }); } } @@ -143,6 +145,7 @@ function (Event $event) { Entry::EVENT_AFTER_MOVE_IN_STRUCTURE, function (ElementStructureEvent $event) { $entry = $event->sender; + if ( $this->settings->activeSections[$entry->section->handle] && !ElementHelper::isDraftOrRevision($entry) && diff --git a/api/plugins/nextbuilds/src/services/Request.php b/api/plugins/nextbuilds/src/services/Request.php index de6bdebc..20d00b91 100755 --- a/api/plugins/nextbuilds/src/services/Request.php +++ b/api/plugins/nextbuilds/src/services/Request.php @@ -34,16 +34,19 @@ class Request extends Component * @return void * @throws \GuzzleHttp\Exception\GuzzleException */ - public function buildPagesFromEntry(Entry $entry) + public function buildPagesFromEntry(Entry $entry, string $revalidateMenu) { $settings = NextBuilds::getInstance()->getSettings(); $client = new Client(); - $endpoint = $this->getSettingsData($settings->nextApiBaseUrl) . self::NEXT_ENDPOINT_REVALIDATE; + $endpoint = $this->getSettingsData($settings->nextApiBaseUrl) . self::NEXT_ENDPOINT_REVALIDATE; $params = [ 'uri' => $entry->uri, 'secret' => $this->getSettingsData($settings->nextSecretToken) ]; + if ($revalidateMenu) { + $params["tags"] = ["navigation"]; + } $requestUrl = $endpoint . '?' . http_build_query($params); Craft::info("Request URL: " .$requestUrl, "REVALIDATE_STATUS"); From 53bb8faeab2721c6e736f1154a54f11ebe294720 Mon Sep 17 00:00:00 2001 From: Eric Rosas Date: Mon, 1 Jul 2024 15:47:50 -0700 Subject: [PATCH 3/4] Updated deprecated class refs for event handler Updated deprecated class refs for event handler --- api/plugins/nextbuilds/src/NextBuilds.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/plugins/nextbuilds/src/NextBuilds.php b/api/plugins/nextbuilds/src/NextBuilds.php index 328ec598..721a5e83 100755 --- a/api/plugins/nextbuilds/src/NextBuilds.php +++ b/api/plugins/nextbuilds/src/NextBuilds.php @@ -17,12 +17,13 @@ use craft\base\Plugin; use craft\elements\Entry; use craft\events\ModelEvent; -use craft\events\ElementStructureEvent; +use craft\events\MoveElementEvent; use craft\helpers\ElementHelper; use craft\services\Plugins; use craft\events\PluginEvent; use castiron\nextbuilds\services\Request as NextRequestService; +use craft\services\Structures; use yii\base\Event; /** @@ -141,9 +142,9 @@ function (Event $event) { ); Event::on( - Entry::class, - Entry::EVENT_AFTER_MOVE_IN_STRUCTURE, - function (ElementStructureEvent $event) { + Structures::class, + Structures::EVENT_AFTER_INSERT_ELEMENT, + function (MoveElementEvent $event) { $entry = $event->sender; if ( From 3630fc3b1f07d6e57f0066d17a209501b4ff39bb Mon Sep 17 00:00:00 2001 From: Eric Rosas Date: Mon, 1 Jul 2024 15:58:23 -0700 Subject: [PATCH 4/4] Added `revalidateMenu` to on-delete event Added `revalidateMenu` to on-delete event --- api/plugins/nextbuilds/src/NextBuilds.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/plugins/nextbuilds/src/NextBuilds.php b/api/plugins/nextbuilds/src/NextBuilds.php index 721a5e83..52c1754e 100755 --- a/api/plugins/nextbuilds/src/NextBuilds.php +++ b/api/plugins/nextbuilds/src/NextBuilds.php @@ -134,8 +134,9 @@ function (Event $event) { !($entry->duplicateOf && $entry->getIsCanonical() && !$entry->updatingFromDerivative) && !ElementHelper::rootElement($entry)->isProvisionalDraft ) { - Craft::$app->onAfterRequest(function() use ($entry) { - $this->request->buildPagesFromEntry($entry); + $revalidateMenu = ($entry->type->handle == "pages"); + Craft::$app->onAfterRequest(function() use ($entry, $revalidateMenu) { + $this->request->buildPagesFromEntry($entry, $revalidateMenu); }); } }