[Bps-public-commit] r17402 - in Net-Google-Code/trunk: lib/Net/Google/Code

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Dec 29 05:03:01 EST 2008


Author: sunnavy
Date: Mon Dec 29 05:03:01 2008
New Revision: 17402

Modified:
   Net-Google-Code/trunk/   (props changed)
   Net-Google-Code/trunk/lib/Net/Google/Code/Ticket.pm

Log:
 r18339 at sunnavys-mb:  sunnavy | 2008-12-29 18:02:33 +0800
 extract comments when ticket is load


Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Ticket.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Ticket.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Ticket.pm	Mon Dec 29 05:03:01 2008
@@ -1,6 +1,7 @@
 package Net::Google::Code::Ticket;
 use Moose;
 use Params::Validate qw(:all);
+use Net::Google::Code::TicketComment;
 
 has id => (
     isa => 'Int',
@@ -28,6 +29,7 @@
 has comments => (
     isa => 'ArrayRef',
     is => 'rw',
+    default => sub { [] },
 );
 
 our @PROPS = qw(status owner closed cc summary reporter description);
@@ -67,7 +69,6 @@
     $self->state->{description} = $text;
     # TODO extract attachments if there are some
 
-
     my ($meta) = $tree->look_down( id => 'issuemeta' );
     my @meta = $meta->find_by_tag_name('tr');
     for my $meta (@meta) {
@@ -111,6 +112,15 @@
         }
     }
 
+    # extract comments
+    my @comments = $tree->look_down( class => 'vt issuecomment' );
+    pop @comments;    # last one is for adding comment
+    for my $comment (@comments) {
+        my $object = Net::Google::Code::TicketComment->new;
+        $object->parse($comment);
+        push @{$self->comments}, $object;
+    }
+
     return $id;
 }
 



More information about the Bps-public-commit mailing list