Showing 5 changed files with 16 additions and 8 deletions
+1 -1
CHANGES
... ...
@@ -1,7 +1,7 @@
1 1
 1.4
2 2
   - fix markdown bugs (*em*, _em_)
3 3
   - default readme file is changed. README is changed to README.md
4
-  - add private repository feature
4
+  - add private repository and collaborator feature
5 5
 1.3
6 6
   - add README.md support
7 7
   - add submodule support
+1 -1
lib/Gitprep.pm
... ...
@@ -18,7 +18,7 @@ use Validator::Custom;
18 18
   eval {require Digest::SHA; import Digest::SHA qw(sha1 sha1_hex)};
19 19
 }
20 20
 
21
-our $VERSION = '1.0301';
21
+our $VERSION = '1.04';
22 22
 
23 23
 has 'dbi';
24 24
 has 'git';
+1
lib/Gitprep/API.pm
... ...
@@ -46,6 +46,7 @@ sub is_collaborator {
46 46
   my ($self, $user, $project, $session_user) = @_;
47 47
 
48 48
   $session_user = $self->cntl->session('user') unless defined $session_user;
49
+  return unless $session_user;
49 50
   
50 51
   my $row = $self->app->dbi->model('collaboration')->select(
51 52
     id => [$user, $project, $session_user]
+12 -6
lib/Gitprep/Manager.pm
... ...
@@ -50,8 +50,12 @@ sub fork_project {
50 50
     $dbi->connector->txn(sub {
51 51
       
52 52
       # Original project id
53
-      my $original_pid = $dbi->model('project')
54
-        ->select('original_pid', id => [$original_user, $project])->value;
53
+      my $project_info = $dbi->model('project')->select(
54
+        ['original_pid', 'private'],
55
+        id => [$original_user, $project]
56
+      )->one;
57
+      
58
+      my $original_pid = $project_info->{original_pid};
55 59
       
56 60
       croak "Can't get original project id"
57 61
         unless defined $original_pid && $original_pid > 0;
... ...
@@ -63,7 +67,8 @@ sub fork_project {
63 67
           $project,
64 68
           {
65 69
             original_user => $original_user,
66
-            original_pid => $original_pid
70
+            original_pid => $original_pid,
71
+            private => $project_info->{private}
67 72
           }
68 73
         );
69 74
       };
... ...
@@ -464,9 +469,9 @@ sub _create_rep {
464 469
       or croak "Can't move post-update";
465 470
     
466 471
     # Description
472
+    my $description = $opts->{description};
473
+    $description = '' unless defined $description;
467 474
     {
468
-      my $description = $opts->{description};
469
-      $description = '' unless defined $description;
470 475
       my $file = "$rep/description";
471 476
       open my $fh, '>', $file
472 477
         or croak "Can't open $file: $!";
... ...
@@ -493,7 +498,8 @@ sub _create_rep {
493 498
       my $file = "$temp_work/README.md";
494 499
       open my $readme_fh, '>', $file
495 500
         or croak "Can't create $file: $!";
496
-      print $readme_fh "$project\n=====\n";
501
+      print $readme_fh "# $project\n";
502
+      print $readme_fh "\n" . encode('UTF-8', $description) . "\n";
497 503
       close $readme_fh;
498 504
       
499 505
       my @git_add_cmd = $git->cmd_rep(
+1
xt/user.t
... ...
@@ -320,6 +320,7 @@ note 'Profile';
320 320
     $t->content_like(qr/t2\.git/);
321 321
     $t->content_like(qr/README\.md/);
322 322
     $t->content_like(qr/kimoto1\@localhost/);
323
+    $t->content_like(qr/Hello/);
323 324
 
324 325
     # Settings page(don't has README)
325 326
     $t->get_ok('/kimoto1/t1/settings');