Use username instead of userid; show "0" when trying to access an 
invalid entry.

        Patch by allen. 

diffs (28 lines):

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;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to