Making WordPress.org

Changeset 13042


Ignore:
Timestamp:
12/08/2023 04:06:15 PM (3 years ago)
Author:
ashfame
Message:

[matrix] trac bot - bail if room alias is empty

File:
1 edited

Legend:

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

    r13027 r13042  
    1818
    1919        // Simulate a webhook request.
    20         // $_GET['secret'] = URL_SECRET__TRAC_BOT;
     20        // $_POST['secret'] = URL_SECRET__TRAC_BOT;
    2121        // $_POST['text'] = 'Hello #40007 and #1232-bbpress'; // Or 'Hello #1232-bbpress'
    2222        // $_POST['user_id'] = '@admin:matrix.test';
    2323        // $_POST['room_id'] = '!XXXXXXXX:matrix.test';
    24         // $_POST['room_alias'] = '#sandbox:matrix.test';
     24        // $_POST['room_alias'] = '#matrix-testing:matrix.test';
    2525        // $_POST['event_id'] = '$HHHHHHHHHHHHH';
    2626
     
    2828        if ( ! isset( $_POST['secret'] ) || $_POST['secret'] !== URL_SECRET__TRAC_BOT ) {
    2929                http_response_code( 403 );
     30                return;
     31        }
     32
     33        // room_name and room_alias can be empty for rooms not published in room directory
     34        if ( empty( $_POST['room_alias'] ) ) {
     35                http_response_code( 204 );
    3036                return;
    3137        }
Note: See TracChangeset for help on using the changeset viewer.