Skip to content

Commit

Permalink
Licensing: exclude revoked licenses from unattached license filter (#…
Browse files Browse the repository at this point in the history
…40215)

* Ensure revoked licenses are excluded when filtering unattached licenses

The `get_user_licenses` method now excludes licenses with `revoked_at !== null` when filtering unattached licenses (`$unattached_only = true`). This ensures that only valid, unattached licenses are returned, improving the reliability of the method's output.

- Updated the parameter docblock to reflect the new behavior.
- Adjusted the filtering logic to include a check for `revoked_at`.

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12087227360

Upstream-Ref: Automattic/jetpack@67dd08a
  • Loading branch information
Initsogar authored and matticbot committed Nov 29, 2024
1 parent 0e1eee8 commit 34500e8
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 63 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This is an alpha version! The changes listed here are not final.
- Only show installation errors on plugins page
- Remove explicit Plugin Install package dependency.
- Remove the 'jetpack-identity-crisis' dependency.
- Resolved an issue where revoked licenses were incorrectly treated as unattached. This caused users to be redirected to the license activation page after site connection, even when unattached licenses were not valid for activation.
- Social | Changed My Jetpack CTA for Social from "Learn more" to "Activate"
- Update composer lock file
- Updated dependencies.
Expand Down
8 changes: 8 additions & 0 deletions jetpack_vendor/automattic/jetpack-licensing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.2-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Changed
- Exclude revoked licenses from results when filtering unattached licenses in `Licensing::get_user_licenses()`. Only unattached and valid licenses are now returned.

## [3.0.1] - 2024-11-25
### Changed
- Updated dependencies. [#40286]
Expand Down Expand Up @@ -308,6 +315,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Licensing: Add support for Jetpack licenses

[3.0.2-alpha]: https://github.com/Automattic/jetpack-licensing/compare/v3.0.1...v3.0.2-alpha
[3.0.1]: https://github.com/Automattic/jetpack-licensing/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/Automattic/jetpack-licensing/compare/v2.0.12...v3.0.0
[2.0.12]: https://github.com/Automattic/jetpack-licensing/compare/v2.0.11...v2.0.12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public function get_license_activation_notice_dismiss() {
/**
* Load current user's licenses.
*
* @param bool $unattached_only Only return unattached licenses.
* @param bool $unattached_only Only return unattached and not revoked licenses.
*
* @return array
*/
Expand All @@ -304,7 +304,7 @@ public function get_user_licenses( $unattached_only = false ) {
$items = array_filter(
$items,
static function ( $item ) {
return $item->attached_at === null;
return $item->attached_at === null && $item->revoked_at === null;
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-my-jetpack/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"automattic/jetpack-connection": "^6.1.0",
"automattic/jetpack-explat": "^0.2.1",
"automattic/jetpack-jitm": "^4.0.1",
"automattic/jetpack-licensing": "^3.0.1",
"automattic/jetpack-licensing": "^3.0.2-alpha",
"automattic/jetpack-plugins-installer": "^0.5.0",
"automattic/jetpack-redirect": "^3.0.1",
"automattic/jetpack-constants": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
),
'jetpack-licensing' => array(
'path' => 'jetpack_vendor/automattic/jetpack-licensing',
'ver' => '3.0.1',
'ver' => '3.0.2-alpha1732893809',
),
'jetpack-my-jetpack' => array(
'path' => 'jetpack_vendor/automattic/jetpack-my-jetpack',
Expand Down
58 changes: 29 additions & 29 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats",
"reference": "577c65ccb49803d3a10ec56c3a0894a2df622815"
"reference": "ac0c44578c10f7006edd9bb001d42faf5b8ff4a2"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -63,7 +63,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "b2c4b7fae9dfb7ae8af90638389a8cd9628f863f"
"reference": "5a9df35d22926df56d11f3c5b07ffad35b55d6e2"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -131,7 +131,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "6884c32fbcb5a4e4e32fc00f58b45e9b6f9dcf39"
"reference": "07afe5c05d0f335e96369d3c4ceb3fc172a47dcc"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -203,7 +203,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
"reference": "8959d2b7b70198f75acdf59613ec47b9680c5ca6"
"reference": "ca4f615c9ec742b0008b0083cb9f5326b89a9fda"
},
"require": {
"composer-plugin-api": "^2.2",
Expand Down Expand Up @@ -274,7 +274,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-core",
"reference": "6048827622ec72cf14bc8db3f30c2264c18e1eb4"
"reference": "539c1ce88c48ba5d7f92891a0ad25cc5581888c5"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -345,7 +345,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-speed-score",
"reference": "9ce41a708ac6f56b7d8f4d4b5f188d81ddd766b2"
"reference": "2b3bb755ec51caec1cb035fa3471866aa9ad8ea3"
},
"require": {
"automattic/jetpack-boost-core": "^0.3.2",
Expand Down Expand Up @@ -424,7 +424,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "8a74977351377d906207a56694c79065755402f4"
"reference": "6b533d422e8dcfe24ced532f5beca7b616a662bc"
},
"require": {
"composer-plugin-api": "^2.2",
Expand Down Expand Up @@ -487,7 +487,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "06c7ce9f1dc6be5f39775fa0cd3e3055f169f648"
"reference": "fbfc8ed4cc2e6ae66a74e2aba9ee1aa87f61d4ce"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -562,7 +562,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "c487b4979434f18e189fb165997ed4306d1870e7"
"reference": "ee09db6c5524e8fb039c333e0f21f6582acb2045"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -655,7 +655,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "d6fef1d1149a934653f1177dd6a512aed8ccfece"
"reference": "dd1047a4c713518aadb4d1ebcb463b41f24c1236"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -712,7 +712,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "d9d96805ba3211d937c0505304a38fd35bcaf3a1"
"reference": "f133d6e784cbc971e1f23d5df38adf3306324024"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -768,7 +768,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-explat",
"reference": "3bb05d3eb07fdedf5763e89ebf783d97e36dbc9a"
"reference": "edd867deb192589ac21e86184e508ccc8d47ba97"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -846,7 +846,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "7c3687fde30be2dd59c58a70c6b62c94d5b27b3b"
"reference": "0d46116f54e122760933e29242423bc921f132e9"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -907,7 +907,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "b549c32272c8c3bec490b895859fcd20f1f8f59d"
"reference": "53641d1f34b4f3a277df9afb12a776a2da541c01"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -980,12 +980,12 @@
},
{
"name": "automattic/jetpack-licensing",
"version": "3.0.1",
"version_normalized": "3.0.1.0",
"version": "3.0.2-alpha.1732893809",
"version_normalized": "3.0.2.0-alpha1732893809",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
"reference": "87c82023f49bbae5cc7daa6b433cdd2579993ee4"
"reference": "ceb1e5922e74460e24199a39e331adddb3168c0e"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -1050,7 +1050,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "7291bb0ad34c02f2c0ccdfd8d27165dbe6c2b22b"
"reference": "e30ad28e0707c9b8d9f543cb3c89316dcda6a87b"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1106,7 +1106,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "565f0729b7b602aff6d15b2a397b5135aba4ae51"
"reference": "70a8ed61e8f92a15cfcfe7bd264fb53e3d57b89c"
},
"require": {
"automattic/jetpack-admin-ui": "^0.5.1",
Expand All @@ -1116,7 +1116,7 @@
"automattic/jetpack-constants": "^3.0.1",
"automattic/jetpack-explat": "^0.2.1",
"automattic/jetpack-jitm": "^4.0.1",
"automattic/jetpack-licensing": "^3.0.1",
"automattic/jetpack-licensing": "^3.0.2-alpha",
"automattic/jetpack-plans": "^0.5.1",
"automattic/jetpack-plugins-installer": "^0.5.0",
"automattic/jetpack-protect-status": "^0.3.1",
Expand Down Expand Up @@ -1211,7 +1211,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "e8ecae5e1c3aa0626bcfeb2488ea55c0f97a6416"
"reference": "3702f6779042ad2830193b7fcef3939b35ad4443"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1275,7 +1275,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "0182721088d7793605375d6264e24eaad3e248ec"
"reference": "6bb1e88c7cd479e3f0c8c6d952299b16f7747c58"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -1346,7 +1346,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "4e976cb1311085db09c05a0b6151ed9575606238"
"reference": "f58e743b61fe28f5fcbaa993e64ad0e079573b3f"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -1405,7 +1405,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-models",
"reference": "4071563786435a5f73af676601dae5f96f6740a4"
"reference": "942a416f349a16255474407f3eab6265f286bd38"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1478,7 +1478,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-status",
"reference": "4090ea6699165126fbfd4a5d104fdac3df577b4d"
"reference": "c8450c9747812083e7e7767e090b1133a361a42e"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -1556,7 +1556,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "d8dabcc80de7184eee5a9fe67e2667090f223378"
"reference": "e58dcade82f5b6c0a1ba1d1c920e0da15b7a194e"
},
"require": {
"automattic/jetpack-status": "^5.0.1",
Expand Down Expand Up @@ -1614,7 +1614,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "fe89c7bef5fb24b2b489cb3ac9ddfcd4a305ff3f"
"reference": "7c2ed470d978a84854e36e93ed9b6bef53573a58"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1671,7 +1671,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "f4f8e018027c91b7e85cfab808d88dfd8b14d5b1"
"reference": "21edd76310df5d5ccfd0386ba2a862923a64d06c"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -1738,7 +1738,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "e3430af43cfe612596962be3e7def4ce10e7c6b6"
"reference": "a414dd6486168693d7b42c4ee2979c77f5130abd"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down
Loading

0 comments on commit 34500e8

Please sign in to comment.