summaryrefslogtreecommitdiffstatshomepage
path: root/src/js/_enqueues/admin/common.js
diff options
context:
space:
mode:
authorTonya Mork <hellofromtonya@git.wordpress.org>2023-02-13 23:08:23 +0000
committerTonya Mork <hellofromtonya@git.wordpress.org>2023-02-13 23:08:23 +0000
commitef4e893fafbb2096999db2ceaf58b2e9f9badfc8 (patch)
tree1edb4f55dc5748f2fc59a65ea3924ace747d3c3b /src/js/_enqueues/admin/common.js
parentc07b57c69311e79c96e24cb104be73aacb8c635c (diff)
downloadwordpress-ef4e893fafbb2096999db2ceaf58b2e9f9badfc8.tar.gz
wordpress-ef4e893fafbb2096999db2ceaf58b2e9f9badfc8.zip
REST API: Remove 'Invalid user ID' error in WP_REST_Users_Controller::update_item().
Removes the `WP_Error` code for `'Invalid user ID.'`. Why? tl;dr This branch will never be entered as the `$user` will never be falsey. Longer reasoning: [39954] introduced `WP_REST_Users_Controller::get_user()` method to encapsulate getting the user and handling the `'Invalid user ID.'` `WP_Error`. It replaced `get_userdata()` in `WP_REST_Users_Controller::update_item()` but left the existing `'Invalid user ID.'` `WP_Error` introduced in [38832]. The code removed in this changeset will never be reached because `$user` will never be falsey. Rather, `WP_REST_Users_Controller::get_user()` will always return an instance of `WP_Error` or `WP_User`. Could the user's ID be falsey? No. Why? `WP_REST_Users_Controller::get_user()` checks that the user exists, which checks if the ID is falsey. Therefore, the code can safely be removed. Follow-up to [39954], [38832]. Props jrf, costdev, hellofromTonya, SergeyBiryukov. Fixes #56662. git-svn-id: https://develop.svn.wordpress.org/trunk@55325 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'src/js/_enqueues/admin/common.js')
0 files changed, 0 insertions, 0 deletions