Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Admin user data to JetPack connected event #108

Merged
merged 28 commits into from
Nov 18, 2024
Merged

Conversation

mr-vara
Copy link
Contributor

@mr-vara mr-vara commented Nov 11, 2024

Proposed changes

This pull request adds users data (array of administrator users for the WordPress site) data to Jetpack connected event.

[
    {
        "id": 1,
        "email": "[email protected]",
    }
]

@@ -66,6 +66,10 @@ public static function get_data( $basename, $data, $mu = false ) {
$plugin['mu'] = $mu;
$plugin['auto_updates'] = ( ! $mu && self::does_it_autoupdate( $basename ) );

if ( strpos( $basename, 'jetpack' ) !== false ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this string match on other Jetpack plugins? Given that Jetpack has the main plugin and other standalone plugins, I'd imagine that maybe we should do an exact match.

Copy link
Contributor

@BrianHenryIE BrianHenryIE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor style/convention comments for @mr-vara

/**
* Get Admin and SuperAdmin user accounts
*
* @return $users Array of Admin & Super Admin users
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To correctly add the type here (so IDEs can understand it, and so people reading find it in the place it's typically expected), the format is <@var|@param|@return> <type> <$variable> <comment>, and in the case of arrays, please include the array shape, i.e. in this case it's actually an array of arrays, but that is not communicated so far.

@return array<array{id:int, email:string}> $users Array of Admin & Super Admin users

*
* @return $users Array of Admin & Super Admin users
*/
private static function get_admin_users() {
Copy link
Contributor

@BrianHenryIE BrianHenryIE Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • We should generally prefer non-static functions. A couple of reasons (although not relevant here): they're easier to work with when testing and easier to work with when extending classes.
  • Please include the return type : array

Edit: I see now that all the other functions in this class are static, so I guess you had to use static anyway!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 14 changed files in this pull request and generated no suggestions.

@BrianHenryIE BrianHenryIE merged commit 92623bc into main Nov 18, 2024
11 of 12 checks passed
@BrianHenryIE BrianHenryIE deleted the PRESS11-17-v2 branch November 18, 2024 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants