Skip to:
Content

bbPress.org

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#2844 closed defect (fixed)

Replies are not created with a unique post guid

Reported by: netweb Owned by: netweb
Milestone: 2.6 Priority: highest
Severity: blocker Version: trunk
Component: Component - Replies Keywords: has-patch
Cc:

Description

Replies are not created with a unique post guid

Behaviour is common with both bbp_insert_reply() and bbp_new_reply_handler()

Note: Only affects /trunk replies do get a unique guid in 2.5 and 2.4

Failing test for replies, and passing test for topics attached:

1) BBP_Tests_Replies_Functions_Reply::test_bbp_insert_reply
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://example.org/?reply=5'
+'http://example.org/?reply'

Attachments (2)

2844-test.diff (1.5 KB) - added by netweb 4 years ago.
2844.1.diff (861 bytes) - added by tharsheblows 4 years ago.
changes 'show_none' where reply_id = 0

Download all attachments as: .zip

Change History (15)

@netweb
4 years ago

#1 @netweb
4 years ago

  • Priority changed from high to highest
  • Severity changed from major to blocker

Also replies can not be created via the backend

Opening http://src.wordpress-develop.dev/wp-admin/post-new.php?post_type=reply will result in:

This webpage is not available

ERR_INCOMPLETE_CHUNKED_ENCODING

The webpage at http://src.wordpress-develop.dev/wp-admin/post-new.php?post_type=reply might be temporarily down or it may have moved permanently to a new web address.

This ticket was mentioned in Slack in #bbpress by tharsheblows. View the logs.


4 years ago

#3 @tharsheblows
4 years ago

ERR_INCOMPLETE_CHUNKED_ENCODING is caused by the case in bbp_get_reply_to_dropdown where reply_id = 0 and then get_the_title just can't handle it (used for 'show_none' in bbp_get_dropdown). This patch doesn't fix the failed phpunit tests though, only the new replies screen, and you might want to change the wording.

@tharsheblows
4 years ago

changes 'show_none' where reply_id = 0

#4 follow-up: @tharsheblows
4 years ago

I can't make BBP_Tests_Replies_Functions_Reply::test_bbp_insert_reply pass for 2.5.8.

My replies in 2.5.8 and 2.6 are getting unique guids when I test manually (? when I do it myself, not unit test, I mean). I noticed if you add in a post_title to the factory it works but that's the only difference I can find between it and topics. This is a "tell me what I'm doing wrong" request btw. :)

#5 @netweb
4 years ago

Replying to tharsheblows:

My replies in 2.5.8 and 2.6 are getting unique guids when I test manually (? when I do it myself, not unit test, I mean).

I am not getting unique guids, manually testing this is via bbPress /trunk r5924 below

Create a topic via the "front end":

<?php
array(
        'ID' => '690',
        'post_author' => '1',
        'post_date' => '2015-08-17 12:02:29',
        'post_date_gmt' => '2015-08-17 02:02:29',
        'post_content' => '2844 Topic',
        'post_title' => '2844 Topic',
        'post_excerpt' => '',
        'post_status' => 'publish',
        'comment_status' => 'closed',
        'ping_status' => 'closed',
        'post_password' => '',
        'post_name' => '2844-topic',
        'to_ping' => '',
        'pinged' => '',
        'post_modified' => '2015-08-17 12:02:29',
        'post_modified_gmt' => '2015-08-17 02:02:29',
        'post_content_filtered' => '',
        'post_parent' => '523',
        'guid' => 'http://src.wordpress-develop.dev/forums/topic/2844-topic/',
        'menu_order' => '0',
        'post_type' => 'topic',
        'post_mime_type' => '',
        'comment_count' => '0'),

Add a reply to the above topic via the "front end":

<?php
array('ID' => '691',
        'post_author' => '1',
        'post_date' => '2015-08-17 12:05:00',
        'post_date_gmt' => '2015-08-17 02:05:00',
        'post_content' => '2844 Reply',
        'post_title' => '',
        'post_excerpt' => '',
        'post_status' => 'publish',
        'comment_status' => 'closed',
        'ping_status' => 'closed',
        'post_password' => '',
        'post_name' => '691',
        'to_ping' => '',
        'pinged' => '',
        'post_modified' => '2015-08-17 12:05:00',
        'post_modified_gmt' => '2015-08-17 02:05:00',
        'post_content_filtered' => '',
        'post_parent' => '690',
        'guid' => 'http://src.wordpress-develop.dev/forums/reply/',
        'menu_order' => '1',
        'post_type' => 'reply',
        'post_mime_type' => '',
        'comment_count' => '0')
);

Note: The above are the results direct from MySQL in wp_posts table exported and formatted as a PHP array ;)

Last edited 4 years ago by netweb (previous) (diff)

#6 in reply to: ↑ 4 @netweb
4 years ago

Replying to tharsheblows:

I noticed if you add in a post_title to the factory it works but that's the only difference I can find between it and topics. This is a "tell me what I'm doing wrong" request btw. :)

This, right, and your correct this is bbp_get_reply_title_fallback() and our adding the filter to the_title()

And, yes if we add post_title to BBP_UnitTest_Factory_For_Reply we get our GUID, we also get other "unexpected" results in the tests, I'll dig around and think about this part some more ¯\_(ツ)_/¯

#7 @tharsheblows
4 years ago

You're right, I'm wrong, don't change the unit tests.

It is working correctly for me on two installs (WP 4.2.4) and not on another (WP trunk), both are at bbPress r5924. I can see where it's failing but have no clue why. bbP is definitely calling wp_insert_post the exact same way but it's failing because in get_post_permalink (in link-template.php in wp-includes), it can't get the post_name.

All that's to say, hmm. It could be that I'm doing something wrong so if you have time, could you check it on WP 4.2.4? Or is that what you're using?

#8 @tharsheblows
4 years ago

In other news, if you merge back to wp:changeset:33262 in WP trunk it works again. <laughs hysterically>

Last edited 4 years ago by netweb (previous) (diff)

This ticket was mentioned in Slack in #bbpress by boone. View the logs.


4 years ago

#10 @tharsheblows
4 years ago

  • Keywords has-patch added; needs-patch removed

The reply guid is fixed in WP and there's a patch for the new reply page failure, so I'm marking as has-patch. I'm unsure of the wording of mine -- should it say "none"? Would it be better as "current topic"? Easy enough to change, I suppose!

#11 @netweb
4 years ago

Ignore any bbp_get_reply_to_dropdown() issues here in this ticket, they're now part of #2617 which I've reopened.

#12 @netweb
4 years ago

  • Owner set to netweb
  • Resolution set to fixed
  • Status changed from new to closed

In 5925:

Tests: Ensure bbPress' custom post types posts are created with a unique GUID.

Props tharsheblows, netweb. Fixes #2844, see also #WP5305 / wp:changeset:33630.

#13 @johnjamesjacoby
3 years ago

In 6316:

Replies: Check for reply hierarchy before assuming topic-title in reply-to.

Fixes a bug causing malformed output when creating a reply via wp-admin.

Props tharsheblows . Fixes #2617. See #2844.

Note: See TracTickets for help on using tickets.