| ... | ... |
@@ -91,38 +91,21 @@ |
| 91 | 91 |
|
| 92 | 92 |
# Delete project |
| 93 | 93 |
elsif ($op eq 'delete-project' && $post) {
|
| 94 |
- |
|
| 95 |
- # Validation |
|
| 96 |
- my $params = $api->params; |
|
| 97 |
- my $rule = [ |
|
| 98 |
- user => [ |
|
| 99 |
- 'user_name' |
|
| 100 |
- ], |
|
| 101 |
- project => [ |
|
| 102 |
- 'project_name' |
|
| 103 |
- ] |
|
| 104 |
- ]; |
|
| 105 |
- my $vresult = app->validator->validate($params, $rule); |
|
| 106 | 94 |
|
| 107 |
- # Delete project |
|
| 108 |
- if ($vresult->is_ok) {
|
|
| 109 |
- my $data = $vresult->data; |
|
| 110 |
- my $user = $data->{user};
|
|
| 111 |
- my $project = $data->{project};
|
|
| 112 |
- |
|
| 113 |
- eval { app->manager->delete_project($user, $project) };
|
|
| 114 |
- if ($@) {
|
|
| 115 |
- app->log->error("/$user/$project/settings:$@");
|
|
| 116 |
- $errors = ['Internal Error']; |
|
| 117 |
- } |
|
| 118 |
- else {
|
|
| 119 |
- flash(message => "Repository $project is deleted."); |
|
| 120 |
- $self->redirect_to("/$user");
|
|
| 121 |
- $self->finish_rendering; |
|
| 122 |
- return; |
|
| 123 |
- } |
|
| 95 |
+ my $user = param('user');
|
|
| 96 |
+ my $project = param('project');
|
|
| 97 |
+ |
|
| 98 |
+ eval { app->manager->delete_project($user, $project) };
|
|
| 99 |
+ if ($@) {
|
|
| 100 |
+ app->log->error("/$user/$project/settings:$@");
|
|
| 101 |
+ $errors = ['Internal Error']; |
|
| 102 |
+ } |
|
| 103 |
+ else {
|
|
| 104 |
+ flash(message => "Repository $project is deleted."); |
|
| 105 |
+ $self->redirect_to("/$user");
|
|
| 106 |
+ $self->finish_rendering; |
|
| 107 |
+ return; |
|
| 124 | 108 |
} |
| 125 |
- else { $errors = $vresult->messages }
|
|
| 126 | 109 |
} |
| 127 | 110 |
%> |
| 128 | 111 |
|
| ... | ... |
@@ -362,5 +362,13 @@ note 'User Account Settings'; |
| 362 | 362 |
$t->post_ok("/kimoto1/t2/settings?op=default-branch", form => {'default-branch' => 'b1'});
|
| 363 | 363 |
$t->content_like(qr/Default branch is changed to b1/); |
| 364 | 364 |
} |
| 365 |
+ |
|
| 366 |
+ note 'Delete project'; |
|
| 367 |
+ {
|
|
| 368 |
+ $t->post_ok('/kimoto1/t2/settings?op=delete-project');
|
|
| 369 |
+ $t->content_like(qr/Repository t2 is deleted/); |
|
| 370 |
+ $t->get_ok('/kimoto1');
|
|
| 371 |
+ $t->content_unlike(qr/t2/); |
|
| 372 |
+ } |
|
| 365 | 373 |
} |
| 366 | 374 |
} |