Skip to content

Commit

Permalink
update lighthouse replica: use auth; versions and attachments can ret…
Browse files Browse the repository at this point in the history
…urn array
  • Loading branch information
sunnavy committed Sep 7, 2009
1 parent b3af3f0 commit 300ef67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 6 additions & 4 deletions lib/App/SD/Replica/lighthouse.pm
Expand Up @@ -69,8 +69,10 @@ sub BUILD {
$self->project( $project );

my $lighthouse = Net::Lighthouse::Project->new(
$email ? ( email => $email, password => $password ) : (),
$token ? ( token => $token ) : (),
auth => {
$email ? ( email => $email, password => $password ) : (),
$token ? ( token => $token ) : (),
},
account => $account,
);
$lighthouse->load( $project );
Expand All @@ -91,15 +93,15 @@ sub get_txn_list_by_date {
creator => $_->creator_name,
created => $_->created_at->epoch,
}
} @{ $ticket_obj->versions };
} $ticket_obj->versions;

if ( $ticket_obj->attachments ) {
my $user = Net::Lighthouse::User->new(
map { $_ => $self->sync_source->lighthouse->$_ }
grep { $self->sync_source->lighthouse->$_ }
qw/account email password token/
);
for my $att ( @{ $ticket_obj->attachments } ) {
for my $att ( $ticket_obj->attachments ) {
$user->load( $att->uploader_id );
push @txns,
{
Expand Down
9 changes: 4 additions & 5 deletions lib/App/SD/Replica/lighthouse/PullEncoder.pm
Expand Up @@ -71,8 +71,8 @@ sub find_matching_transactions {
my $sequence = 0;
# hack, let's add sequence for comments
my @raw_versions =
map { $_->{sequence} = $sequence++; $_ } @{ $args{ticket}->versions };
my @raw_attachments = @{ $args{ticket}->attachments|| [] };
map { $_->{sequence} = $sequence++; $_ } $args{ticket}->versions;
my @raw_attachments = $args{ticket}->attachments;

my @raw_txns = ( @raw_versions, @raw_attachments );
my @txns;
Expand Down Expand Up @@ -256,8 +256,7 @@ sub transcode_one_txn {
my $user = Net::Lighthouse::User->new(
map { $_ => $self->sync_source->lighthouse->$_ }
grep { $self->sync_source->lighthouse->$_ }
qw/account
email password token/
qw/account auth/
);
eval { $user->load($old) };
if ($@) {
Expand Down Expand Up @@ -397,7 +396,7 @@ sub resolve_user_id_to {
my $user = Net::Lighthouse::User->new(
map { $_ => $self->sync_source->lighthouse->$_ }
grep { $self->sync_source->lighthouse->$_ }
qw/account email password token/
qw/account auth/
);
$user->load( $id );
return $user->name;
Expand Down

0 comments on commit 300ef67

Please sign in to comment.