Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments Block (legacy): Don't render empty block wrapper #42737

Closed
wants to merge 1 commit into from

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Jul 27, 2022

What?

Follow-up to @DAreRodz #41807 (comment):

Another thing I've noticed is that the block renders in those cases where the comments_template()'s output is empty. This should be a quick fix. 馃檪

Why?

To avoid an empty block wrapper for no content.

How?

By adding a check if comments_template()'s return value is empty(), and returning an empty string if it is.

Testing Instructions

TDB

Screenshots or screencast

@ockham ockham added [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop [Block] Comments (legacy) The legacy mode of the Comments block (formerly known as Post Comments) labels Jul 27, 2022
@ockham ockham self-assigned this Jul 27, 2022
@ockham
Copy link
Contributor Author

ockham commented Jul 28, 2022

From #41807 (comment):

[I] but was struggling to reproduce in what cases comments_template()'s output would be empty. (I tried a post with no comments and disabled comments for it to also hide the comments form, but we already have code in trunk to bail early in that case.) Maybe you can help me fill in the testing instructions there? 馃檶

@DAreRodz
Copy link
Contributor

DAreRodz commented Aug 1, 2022

Maybe you can help me fill in the testing instructions there? 馃檶

IIRC I saw the problem when I added the Comments block inside a Query Loop block (e.g., in the Home template). The block renders empty because comments_template() doesn't return anything.

Could it be a good idea also to show a warning message if you place this block in an invalid template? Just for the legacy version, I mean (not sure if this is worth the effort). 馃

@jordesign
Copy link
Contributor

Closing this issue as the Legacy Comments block has been deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Comments (legacy) The legacy mode of the Comments block (formerly known as Post Comments) [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants