[Bps-public-commit] smokingit branch, master, updated. 48d6cfb68622ac36627b1cc2ddcc0e659cb158ee

Alex Vandiver alexmv at bestpractical.com
Tue Jun 17 20:58:29 EDT 2014


The branch, master has been updated
       via  48d6cfb68622ac36627b1cc2ddcc0e659cb158ee (commit)
      from  31122f58778b4c670a62aeb2102953e817db089f (commit)

Summary of changes:
 lib/Smokingit/Model/Branch.pm | 23 ++++++++++++++++++-----
 lib/Smokingit/Model/Commit.pm |  7 ++++++-
 2 files changed, 24 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 48d6cfb68622ac36627b1cc2ddcc0e659cb158ee
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 17 20:58:25 2014 -0400

    Make serialized data more complete

diff --git a/lib/Smokingit/Model/Branch.pm b/lib/Smokingit/Model/Branch.pm
index 8338aae..a581e94 100644
--- a/lib/Smokingit/Model/Branch.pm
+++ b/lib/Smokingit/Model/Branch.pm
@@ -8,7 +8,8 @@ use Scalar::Util qw/blessed/;
 use Smokingit::Record schema {
     column project_id =>
         references Smokingit::Model::Project,
-        is protected;
+        is protected,
+        serialized as {name => "project"};
 
     column name =>
         type is 'text',
@@ -17,15 +18,18 @@ use Smokingit::Record schema {
 
     column first_commit_id =>
         references Smokingit::Model::Commit,
-        is protected;
+        is protected,
+        serialized as {name => "first_commit"};
 
     column current_commit_id =>
         references Smokingit::Model::Commit,
-        is protected;
+        is protected,
+        serialized as {name => "current_commit"};
 
     column tested_commit_id =>
         references Smokingit::Model::Commit,
-        is protected;
+        is protected,
+        serialized as {name => "tested_commit"};
 
     column last_status_update =>
         references Smokingit::Model::Commit,
@@ -56,7 +60,8 @@ use Smokingit::Record schema {
         type is 'text';
 
     column to_merge_into =>
-        references Smokingit::Model::Branch;
+        references Smokingit::Model::Branch,
+        serialized as {name => "to_merge_into"};
 
     column current_actor =>
         type is 'text',
@@ -333,5 +338,13 @@ sub current_user_can {
     return $self->SUPER::current_user_can($right => %args);
 }
 
+sub jifty_serialize_format {
+    my $self = shift;
+    my $data = $self->SUPER::jifty_serialize_format(@_);
+    $data->{status}      = $self->current_commit->status;
+    $data->{long_status} = $self->current_commit->long_status;
+    return $data;
+}
+
 1;
 
diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index bee62e6..5a07ef4 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -6,7 +6,8 @@ use Jifty::DBI::Schema;
 
 use Smokingit::Record schema {
     column project_id =>
-        references Smokingit::Model::Project;
+        references Smokingit::Model::Project,
+        serialized as {name => "project"};
 
     column sha =>
         type is 'text',
@@ -292,5 +293,9 @@ sub jifty_serialize_format {
     return $data;
 }
 
+sub default_serialized_as_columns {
+    return ('id', 'sha', 'subject');
+}
+
 1;
 

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


More information about the Bps-public-commit mailing list