[Bps-public-commit] SD branch, master, updated. 0.70-32-gbf7008a

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Sep 2 01:10:46 EDT 2009


The branch, master has been updated
       via  bf7008a0599a9ba3afc91d2f59b2818cdc47e02a (commit)
      from  69509b20dfd41a3d42aa7223002b2fe03cbf2076 (commit)

Summary of changes:
 lib/App/SD/Replica/lighthouse/PushEncoder.pm |   29 ++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit bf7008a0599a9ba3afc91d2f59b2818cdc47e02a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Sep 2 13:10:26 2009 +0800

    handle body,milestone and owner better when pushing for lighthouse

diff --git a/lib/App/SD/Replica/lighthouse/PushEncoder.pm b/lib/App/SD/Replica/lighthouse/PushEncoder.pm
index 22fb287..02950d3 100644
--- a/lib/App/SD/Replica/lighthouse/PushEncoder.pm
+++ b/lib/App/SD/Replica/lighthouse/PushEncoder.pm
@@ -136,8 +136,33 @@ sub _recode_props_for_integrate {
         elsif ( $key eq 'status' ) {
             $attr{state} = $props{$key};
         }
-        elsif ( $key eq 'body' ) {
-            $attr{$key} = $props{$key} || '[no body]';
+        elsif ( $key eq 'content' ) {
+            $attr{body} = $props{$key} || '[no body]';
+        }
+        elsif ( $key eq 'milestone' ) {
+            my $milestone = $self->sync_source->lighthouse->milestone;
+            if ( $props{$key} ) {
+                eval { $milestone->load( $props{$key} ) };
+                if ( $@ ) {
+                    warn "no milestone $props{$key} exist";
+                }
+                else {
+                    $attr{milestone_id} = $milestone->id;
+                }
+            }
+            else {
+                $attr{milestone_id} = undef,
+            }
+        }
+        elsif ( $key eq 'owner' ) {
+            if ( $props{key} ) {
+                if ( $props{$key} =~ /\((\d+)\)/ ) {
+                    $attr{assigned_user_id} = $1;
+                }
+            }
+            else {
+                $attr{assigned_user_id} = undef;
+            }
         }
         else {
             $attr{$key} = $props{$key};

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list