Wp-calypso: Reader: Comment textfield doesn't show up for Discover posts

Created on 27 Sep 2016  路  4Comments  路  Source: Automattic/wp-calypso

I've noticed this happen:

  • On Discover posts only
  • In Chrome and FF
  • Posts with zero comments

Refreshing the browser doesn't fix it as well.

screenshot 2016-09-26 17 27 06

Example post: https://wordpress.com/read/feeds/41325786/posts/1167388432

Reader [Type] Bug

All 4 comments

Confirmed in Safari, too.

screen shot 2016-09-26 at 5 32 09 pm

See this line

// client/blocks/comments/form.jsx
//...
// Don't display the form if comments are closed
render() {
    // ...
    if ( post && post.discussion && post.discussion.comments_open === false ) {
        // If we already have some comments, show a 'comments closed message'
        if ( post.discussion.comment_count && post.discussion.comment_count > 0 ) {
            return <p className="comments__form-closed">{ translate( 'Comments are closed.' ) }</p>;
        }

        return null;
    }
    // ...
}
//...

I believe the post information is retrieved by accessing WordPress API and the API return false for post.discussion.comments_open. It seems that the issue is on the API.

Samples API:

Thanks for investigating @ivantedja!

There's some special logic for Discover posts that is applied elsewhere using the shouldShowComments helper:

https://github.com/Automattic/wp-calypso/blob/master/client/blocks/comments/helper.jsx#L7

It looks like we need to account for Discover posts here, too.

@bluefuton thanks for the explanation!

Was this page helpful?
0 / 5 - 0 ratings