Making WordPress.org

Changeset 12345


Ignore:
Timestamp:
12/19/2022 05:08:34 AM (17 months ago)
Author:
dd32
Message:

Support Forums: Blocks: Don't treat a non-block post as a block post during edit.

During the bbPress edit topic/reply POST submission, bbp_is_reply_edit() and bbp_is_topic_edit() are not truthful.

See https://github.com/Automattic/blocks-everywhere/pull/120.
See #6608.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-blocks.php

    r12344 r12345  
    268268        $use_it            = ( $enabled_for_user && $enabled_for_forum );
    269269
    270         // If we're editing a post made without the editor, let's respect that.
    271         if ( $use_it && bbp_is_reply_edit() ) {
    272             $reply = bbp_get_reply( bbp_get_reply_id() );
    273 
    274             if ( $reply && ! has_blocks( $reply->post_content ) ) {
    275                 $use_it = false;
    276             }
    277         } elseif ( $use_it && bbp_is_topic_edit() ) {
    278             if ( ! has_blocks( get_post_field( 'post_content', bbp_get_topic_id() ) ) ) {
    279                 $use_it = false;
     270        if ( $use_it ) {
     271            $reply_id = bbp_is_reply_edit() ? bbp_get_reply_id() : ( ( bbp_is_post_request() && ! empty( $_POST['action'] ) && 'bbp-edit-reply' === $_POST['action'] ) ? $_POST['bbp_reply_id'] : 0 );
     272            $topic_id = bbp_is_topic_edit() ? bbp_get_topic_id() : ( ( bbp_is_post_request() && ! empty( $_POST['action'] ) && 'bbp-edit-topic' === $_POST['action'] ) ? $_POST['bbp_topic_id'] : 0 );
     273
     274            // If we're editing a post made without the editor, let's respect that.
     275            if ( $reply_id ) {
     276                $reply = bbp_get_reply( $reply_id );
     277
     278                if ( $reply && ! has_blocks( $reply->post_content ) ) {
     279                    $use_it = false;
     280                }
     281            } elseif ( $topic_id ) {
     282                if ( ! has_blocks( get_post_field( 'post_content', $topic_id ) ) ) {
     283                    $use_it = false;
     284                }
    280285            }
    281286        }
Note: See TracChangeset for help on using the changeset viewer.