Making WordPress.org

Changeset 13026


Ignore:
Timestamp:
12/07/2023 05:14:02 PM (12 months ago)
Author:
ashfame
Message:

[matrix] always treat #matrix-testing room as testground, never posting on Trac from there

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/matrix/trac-bot.php

    r13025 r13026  
    1414namespace Dotorg\Matrix\Trac {
    1515
    16     define( 'DISABLE_TRAC_TICKETS_UPDATION', true ); // For testing, this prevents test stuff to be posted on Trac tickets.
    1716    define( 'REPOST_MATRIX_LINK_TIME', 300 ); // 5 mins
    1817    define( 'REPOST_TRAC_COMMENT_TIME', 7200 ); // 2 hrs
     
    3332
    3433    $room_alias_local_part = ltrim( explode( ':', $_POST['room_alias'] )[0], '#' );
     34
     35    define( 'IS_MATRIX_TESTING_ROOM', $room_alias_local_part === 'matrix-testing' );
    3536
    3637    // Prevent frequent posting to both Matrix & Trac using Redundancy Manager.
     
    120121        }
    121122
    122         if ( ! DISABLE_TRAC_TICKETS_UPDATION ) {
     123        if ( ! IS_MATRIX_TESTING_ROOM ) {
    123124            if ( defined( TRACBOT_WPORG_PASSWORD ) && ! empty( TRACBOT_WPORG_PASSWORD ) ) {
    124125                $trac_xmlrpc = new \Trac( 'matrixbot', TRACBOT_WPORG_PASSWORD, "https://$trac.trac.wordpress.org/login/xmlrpc" );
     
    152153            $redundancy_manager->set( 'trac', $trac, 'ticket', $ticket_id );
    153154
    154             if ( ! DISABLE_TRAC_TICKETS_UPDATION ) {
     155            if ( ! IS_MATRIX_TESTING_ROOM ) {
    155156                isset( $trac_xmlrpc ) && $trac_xmlrpc->ticket_update( $ticket_id, $trac_comment );
     157            } else {
     158                $matrix_message[] = "[$trac] Trac comment: " . $trac_comment;
    156159            }
    157160        }
Note: See TracChangeset for help on using the changeset viewer.