Making WordPress.org

Changeset 13609


Ignore:
Timestamp:
04/29/2024 07:02:02 AM (8 weeks ago)
Author:
dd32
Message:

Plugin Directory: Fix an issue where some ZIP uploads would not properly notify reviewers in Helpscout.

Helpscout rejects API requests which specify a firstName or lastName that is 0 or 41+ characters long.

See #7598, [13607].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

    r13607 r13609  
    768768     * @return bool True if the email was updated, false otherwise.
    769769     */
    770     public function update_review_email( $post, $attachment ) {
     770    public static function update_review_email( $post, $attachment ) {
    771771        $review_email = self::find_review_email( $post );
    772772        if ( ! $review_email ) {
     
    789789        $name = wp_get_current_user()->display_name ?: wp_get_current_user()->user_login;
    790790        $payload = [
    791             'customer' => [
    792                 'firstName' => explode( ' ', $name, 2 )[0],
    793                 'lastName'  => trim( explode( ' ', "{$name} ", 2 )[1] ),
     791            'customer' => array_filter( [
     792                'firstName' => substr( explode( ' ', $name, 2 )[0], 0, 39 ),
     793                'lastName'  => trim( substr( explode( ' ', "{$name} ", 2 )[1], 0, 39 ) ),
    794794                'email'     => wp_get_current_user()->user_email,
    795             ],
     795            ] ),
    796796            'text'   => $text,
    797797            'status' => 'active',
Note: See TracChangeset for help on using the changeset viewer.