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 a963ba8 commit b89d5db
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 69 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This is an alpha version! The changes listed here are not final.
- Components: Add __nextHasNoMarginBottom to BaseControl-based components, preventing deprecation notices.
- General: indicate compatibility with the upcoming version of WordPress - 6.7.
- Replaces custom IconTooltip in favour of js-packages/components version
- 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"
- Updated dependencies.
- Updated package 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
64 changes: 32 additions & 32 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": "a605e0e82a95f46b1878ce25b6453fc63ba4a608"
"reference": "b91c2d4f2a07dc8065e797ee32accfd76b64aa50"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -63,7 +63,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "0f01a305d06305c8da603e0b324d628b395183ab"
"reference": "05e66caaa0d28fed59cac82e574702da9b048576"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -131,7 +131,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "75935a03e15227d0f0ac2abb6d25269940d7443e"
"reference": "6d062d1955662d3caf4fe890bc2b4702056c2a19"
},
"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": "29d7b4b064aaf79da5084b0aa4972d3734b992ec"
"reference": "a1201580489aff1666d88403d891d63e86e130d0"
},
"require": {
"composer-plugin-api": "^2.2",
Expand Down Expand Up @@ -274,7 +274,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-backup-helper-script-manager",
"reference": "e0199d76131a4432b784c2656efd5b1e541fa289"
"reference": "51326b0979598881a15c03e6822bb95d5d480ad9"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -337,7 +337,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-core",
"reference": "804b172516cbd0182ef5ee577d46ba595839799f"
"reference": "07812037deeacf307bd865f1d3a0e4f14d3d6d21"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -408,7 +408,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-speed-score",
"reference": "d697a2ebed35a84585fb61606cc693801c204283"
"reference": "1723d0f1c0190a439f410c1fe38cfd93e64c9f84"
},
"require": {
"automattic/jetpack-boost-core": "^0.3.2",
Expand Down Expand Up @@ -487,7 +487,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "aebff0d654c2b7d104e4999cd45599d90da85f2d"
"reference": "f1616cf7cae101416591f5668d6c308c5c6a4ec3"
},
"require": {
"composer-plugin-api": "^2.2",
Expand Down Expand Up @@ -550,7 +550,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "828b6f92fbc4d700dfd98ef9fe783291863e9f5f"
"reference": "52afb158cee749aaf6087c1e05c29ce6c3897fd7"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -625,7 +625,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "6a9916464897b7b7b9efcb140801baa5a12d5ecd"
"reference": "f72a55705c3a2ae9ddfa627bbde1fd8cbac696f2"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -718,7 +718,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "2d3fdfb1a267ed21087bd61f5dc5552be5ce7ecd"
"reference": "354e3d7086d08543a200faa0661c5eb546093f35"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -775,7 +775,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "2558f7e3eda81ce94cc0e93ec120950fa9529ae2"
"reference": "517dedf9d9ca4abac5278b3357393c783b5013df"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -831,7 +831,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-explat",
"reference": "0691035addcae03aff440a8126389683852b4405"
"reference": "415adddb55b2eb436948c0f2326e4372ae6dad9b"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -909,7 +909,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "5eb5f4c813c090f51ffb7035deb1c1dc7170c5d2"
"reference": "0ffcaa1f7a3de6bfefd15feade68543c4182d292"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -970,7 +970,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "8cfdac4da1e97dbad7250c095c51d6752d0d7288"
"reference": "e24de4320a6dabe61b2333c3a6a822e4a03ce22c"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -1043,12 +1043,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": "5177180637fbf6bfa3ef39f8d36012dc54df7362"
"reference": "f285e6d698040be6374cb550c1e444a698f5855b"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -1113,7 +1113,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "697d6113584291df12f805297c554d63aa6af5e3"
"reference": "efbb811ac353c3835fd6f6b52de902a1a1afdc3f"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1169,7 +1169,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "65a5bb7b1f36b363133030aec91dd52909b8865a"
"reference": "01cdbbd80b4766fb64641231f448329cf34ea852"
},
"require": {
"automattic/jetpack-admin-ui": "^0.5.1",
Expand All @@ -1179,7 +1179,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 @@ -1274,7 +1274,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "3eedfa522c0cad412416dc581d90e31734bf27d2"
"reference": "e5f7dfbc76c17a95c92b2e838d6e254b10f73ae6"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1338,7 +1338,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "616793fe60b5d02cb6785cd26d771ac982e7a1f1"
"reference": "d6e027d23317279fe9a9dc0877b5e419e5194892"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -1409,7 +1409,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "bb6b675e134086ace937053cb3e1850ae574d394"
"reference": "d6662286d6f8e98e353d6e8804dde5f335c6aa88"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -1468,7 +1468,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-models",
"reference": "9fa7870820f5e0bd3cabafc52ecd070b06e58e86"
"reference": "056646a54506fc3ee231ebe47bfbd92f6161e91e"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1541,7 +1541,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-status",
"reference": "6d8433742b56815069d47e35c70b95fede7140ee"
"reference": "6748785bdcede13adb21fae2f4fb0b10d288c154"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -1619,7 +1619,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "baca2a620474e658d87f788b1f096d6eb511ca9f"
"reference": "d63788f0684564946983dd9de3511088933cd50a"
},
"require": {
"automattic/jetpack-status": "^5.0.1",
Expand Down Expand Up @@ -1677,7 +1677,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "47e3d6e4d29c357419126b2294d2ba3cf8f0e16e"
"reference": "0620d07d812daf45e5c3c8dcde07027db4ce5e35"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1734,7 +1734,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "7c5f12655ab0aaac8db89c5d9e4dd16c818b6834"
"reference": "565c493d4951756cc24e82225e3777f0c1c2a091"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -1801,7 +1801,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "0a38b3a925143474b730e6989c95d681f143c3fa"
"reference": "9c82b8b05123d8d0b41e122d8cda7c47c513b9dc"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down Expand Up @@ -1882,7 +1882,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-transport-helper",
"reference": "0862fc55ea025e4aa664184a49a8d5cb0b0d771c"
"reference": "2b8690edbc697f6120b2abd6ad652fbb5a7a4bef"
},
"require": {
"automattic/jetpack-backup-helper-script-manager": "^0.3.1",
Expand Down Expand Up @@ -1960,7 +1960,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-waf",
"reference": "a4aa8c286d83ff91366dda772f0d142a37cfc320"
"reference": "7aca4700ed254158c4e3ba95f4534f616571f434"
},
"require": {
"automattic/jetpack-connection": "^6.1.0",
Expand Down
Loading

0 comments on commit b89d5db

Please sign in to comment.