(for some reason I am currently unable to write a comment to this bug, I get this:
Only the owner or submitter of the bug, or a sufficiently empowered user, may make that change to the op_sys field.
Old value:
New value: All
So I'm posting it here)
I just went checking into this, there will also be a problem if there are more than 50 screened comments, or 25 screened comments. It will try to show multiple pages or a threaded view, because of this:
my $post_count = 0;
while (my $post = $sth->fetchrow_hashref) {
$post_count++ unless ($post->{'state'} eq "D");
$posts{$post->{'talkid'}} = $post;
push @{$children{$post->{'parenttalkid'}}}, $post->{'talkid'};
}
Will count everything unless the post was deleted. Screened comments should be taken into account, but not just like this:
$post_count++ unless (($post->{'state'} eq "D") || (post->{'state'} eq "S"));
As some people are indeed allowed to see screened comments.
I'm a bit worried that calling LJ::Talk::can_view_screened that many times to get the real count is going to be overkill.
Would it be acceptable to try and call that function so many times ? it's being done again later actually, and this is just to get the count of items. Like we could drop them into a hash while doing so we don't need to call the function again later.