[dw-free] Add comment-count image to crossposted entries
[commit: http://hg.dwscoalition.org/dw-free/rev/4519ca92ccc7]
http://bugs.dwscoalition.org/show_bug.cgi?id=1035
Use username instead of userid; show "0" when trying to access an invalid
entry.
Patch by
allen.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1035
Use username instead of userid; show "0" when trying to access an invalid
entry.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/Entry.pm
- htdocs/tools/commentcount.bml
-------------------------------------------------------------------------------- diff -r d23c0007a311 -r 4519ca92ccc7 cgi-bin/LJ/Entry.pm --- a/cgi-bin/LJ/Entry.pm Sat Aug 08 12:18:52 2009 +0000 +++ b/cgi-bin/LJ/Entry.pm Sat Aug 08 12:40:49 2009 +0000 @@ -231,7 +231,7 @@ sub comment_image_url { my $self = shift; my $u = $self->{u}; - return "$LJ::SITEROOT/tools/commentcount?uid=" . $self->journalid . "&ditemid=" . $self->ditemid; + return "$LJ::SITEROOT/tools/commentcount?user=" . $self->journal->user . "&ditemid=" . $self->ditemid; } # returns a pre-generated comment img tag using the comment_image_url diff -r d23c0007a311 -r 4519ca92ccc7 htdocs/tools/commentcount.bml --- a/htdocs/tools/commentcount.bml Sat Aug 08 12:18:52 2009 +0000 +++ b/htdocs/tools/commentcount.bml Sat Aug 08 12:40:49 2009 +0000 @@ -8,10 +8,10 @@ # the given post. my $ditemid = $GET{ditemid}; - my $uid = $GET{uid}; + my $uid = LJ::get_userid( $GET{user} ); # get the value to display - my $count = $GET{samplecount} || LJ::Entry->new( $uid, ditemid => $ditemid )->reply_count; + my $count = $GET{samplecount} || eval { LJ::Entry->new( $uid, ditemid => $ditemid )->reply_count } || 0; # create an image my $image = Image::Magick->new; --------------------------------------------------------------------------------