Making WordPress.org

Changeset 13010


Ignore:
Timestamp:
12/05/2023 02:32:44 AM (10 months ago)
Author:
dd32
Message:

Helpscout: Store stats per-mailbox too.

See #6994.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/webhook.php

    r12613 r13010  
    8282
    8383    // Determine the WordPress.org user for this HelpScout user.
     84    $stat_user  = 'HS-' . get_client()->name . '-' . $hs_user_id;
    8485    $wporg_user = get_wporg_user_for_helpscout_user( $hs_user_id );
    8586    if ( $wporg_user ) {
    8687        $stat_user = $wporg_user->user_nicename;
    87     } else {
    88         $client    = get_client();
    89         $stat_user = "HS-{$client->name}-{$hs_user_id}";
    9088    }
     89
     90    // Per-mailbox stats.
     91    $mailbox = get_mailbox_name( $request );
    9192
    9293    // Total actions performed by user.
    9394    bump_stats_extra( 'hs-total', $stat_user );
     95
     96    if ( $mailbox ) {
     97        bump_stats_extra( 'hs-' . $mailbox . '-total', $stat_user );
     98    }
    9499
    95100    // Specific actions performed by user, replies and outgoing emails are counted as replies.
     
    97102        case 'convo.agent.reply.created':
    98103            bump_stats_extra( 'hs-replies', $stat_user );
     104
     105            if ( $mailbox ) {
     106                bump_stats_extra( 'hs-' . $mailbox . '-replies', $stat_user );
     107            }
    99108            break;
    100109        case 'convo.created':
    101110            if ( 'user' === $request->createdBy->type ?? '' ) {
    102111                bump_stats_extra( 'hs-replies', $stat_user );
     112
     113                if ( $mailbox ) {
     114                    bump_stats_extra( 'hs-' . $mailbox . '-replies', $stat_user );
     115                }
    103116            }
    104117            break;
Note: See TracChangeset for help on using the changeset viewer.