So, the title speaks for itself... I have no comment, but the box still appears... empty of course... I'm unsure which part of drupal it is...
btw is it possible to edit this block? I mean, to setup how many comments we want in it, things like that...

Comments

eafarris’s picture

StatusFileSize
new1017 bytes

Attached is a patch to hide the block if there aren't any comments.

Yes, some settings for this block would be nice.

Julien PHAM’s picture

Thanks, it works perfectly. I was unable to figure out how to apply a patch on windows, so I apply it myself by editing the comment.module.

Would be fine to commit this patch in a new comment version...

Julien PHAM’s picture

StatusFileSize
new1.05 KB

So, I join the patch I generated with tortoise cvs...

Julien PHAM’s picture

hehe I'm stupid, the patch already has been posted in this thread :)

eafarris’s picture

Status: Active » Needs review

Let's add it to the queue, then.

Julien PHAM’s picture

Perhaps would be fine to commit such a patch in the next comment.module version. I used it for some time now and it seems it works fine... but I have to apply it every time I update my drupal.

Thanks

chx’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.38 KB

Indeed this is a bug which worths fixing. Rerolled a simplified version against HEAD.

chx’s picture

StatusFileSize
new942 bytes

Darn, something slipped in -- and the comment part just filled my screen so i have not realized it continues :(

killes@www.drop.org’s picture

I think what we need is a general guideline. What should happen to blocks that have no items? Should they magically dissappear (like implemented in this patch) or should there be a message "no comments found"?

chx’s picture

Status: Reviewed & tested by the community » Needs review
Kjartan’s picture

StatusFileSize
new799 bytes

Here is a simpler patch which makes the recent comments block work like other blocks. The block system already has checks to not display blocks that return no content.

coreb’s picture

Version: x.y.z » 4.7.x-dev

Moving out of the "x.y.z" queue to a real queue.

joshk’s picture

+1 For Kjartan's patch.

Block's w/no content don't display. This is intuitive, and how blog block and others work when their queries turn up no results.

joshk’s picture

Version: 4.7.x-dev » 5.x-dev
Status: Needs review » Reviewed & tested by the community

This applied clean against fresh 5.0.dev checkout. Works as advertised.

dries’s picture

Kjartan's patch looks good. Not showing empty blocks has a number of downsides:

1. It's confusing. You enable the block, but it doesn't shows up.
2. It might be a performance cost; you don't realize there are certain blocks that you might as well disable.

Kjartan’s picture

Dries, that's all true, but my patch makes the comment block consistent with the other blocks in core. Not showing empty blocks has been the standard for a long time. For 5.0 it seems easier to make comment block work the same as the rest, and then evaluate if we want to change this for a future release.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)