... | ... |
@@ -6,14 +6,19 @@ |
6 | 6 |
my $base_user_id = param('user'); |
7 | 7 |
my $base_project_id = param('project'); |
8 | 8 |
my $row_id = param('row_id'); |
9 |
- |
|
10 |
- # Pull requests |
|
11 |
- my $pull_request = app->dbi->model('pull_request')->select( |
|
9 |
+ |
|
10 |
+ # Issue |
|
11 |
+ my $issue = app->dbi->model('issue')->select( |
|
12 | 12 |
[ |
13 | 13 |
{__MY__ => '*'}, |
14 |
- {'__open_user' => ['id']} |
|
14 |
+ {__open_user => ['id']} |
|
15 | 15 |
], |
16 |
- where => {'pull_request.row_id' => $row_id} |
|
16 |
+ where => {'issue.row_id' => $row_id} |
|
17 |
+ )->one; |
|
18 |
+ |
|
19 |
+ # Pull requests |
|
20 |
+ my $pull_request = app->dbi->model('pull_request')->select( |
|
21 |
+ where => {row_id => $issue->{pull_request}} |
|
17 | 22 |
)->one; |
18 | 23 |
|
19 | 24 |
# Base information |
... | ... |
@@ -98,7 +103,7 @@ |
98 | 103 |
# Close pull request |
99 | 104 |
my $op = param('op'); |
100 | 105 |
if ($op eq 'close') { |
101 |
- app->dbi->model('pull_request')->update( |
|
106 |
+ app->dbi->model('issue')->update( |
|
102 | 107 |
{ |
103 | 108 |
open => 0, |
104 | 109 |
open_user => $session_user_row_id |
... | ... |
@@ -110,7 +115,7 @@ |
110 | 115 |
} |
111 | 116 |
elsif ($op eq 'reopen') { |
112 | 117 |
my $open_time = time; |
113 |
- app->dbi->model('pull_request')->update( |
|
118 |
+ app->dbi->model('issue')->update( |
|
114 | 119 |
{ |
115 | 120 |
open => 1, |
116 | 121 |
open_time => $open_time, |
... | ... |
@@ -147,10 +152,9 @@ |
147 | 152 |
# Push |
148 | 153 |
app->manager->push($work_rep_info, $base_branch); |
149 | 154 |
|
150 |
- app->dbi->model('pull_request')->update( |
|
155 |
+ app->dbi->model('issue')->update( |
|
151 | 156 |
{ |
152 |
- open => 0, |
|
153 |
- open_user => $session_user_row_id |
|
157 |
+ open => 0 |
|
154 | 158 |
}, |
155 | 159 |
where => {row_id => $row_id} |
156 | 160 |
); |
... | ... |
@@ -179,18 +183,18 @@ |
179 | 183 |
# End commit |
180 | 184 |
my $end_commit = $git->get_commit($target_rep_info, $target_branch); |
181 | 185 |
|
182 |
- # Pull request first message |
|
186 |
+ # Issue first message |
|
183 | 187 |
my $issue_message_first = app->dbi->model('issue_message')->select( |
184 | 188 |
[ |
185 | 189 |
{__MY__ => '*'}, |
186 | 190 |
{__user => ['id']} |
187 | 191 |
], |
188 |
- where => {pull_request => $row_id, number => 1} |
|
192 |
+ where => {issue => $row_id, number => 1} |
|
189 | 193 |
)->one; |
190 | 194 |
|
191 | 195 |
# Check merge automatically |
192 | 196 |
my $merge_success; |
193 |
- if ($api->can_write_access($session_user_id, $base_user_id, $base_project_id) && $pull_request->{open}) { |
|
197 |
+ if ($api->can_write_access($session_user_id, $base_user_id, $base_project_id) && $issue->{open}) { |
|
194 | 198 |
|
195 | 199 |
my $lock_fh = $self->app->manager->lock_rep($work_rep_info); |
196 | 200 |
|
... | ... |
@@ -225,7 +229,7 @@ |
225 | 229 |
my $ssh_rep_url = "ssh://$execute_user\@" . $url->host |
226 | 230 |
. ($ssh_port ? ":$ssh_port" : '') . "$ssh_rep_url_base/$user/$project.git"; |
227 | 231 |
|
228 |
- my $patch_url = url_for("/$base_user_id/$base_project_id/pull/$pull_request->{row_id}.patch")->to_abs; |
|
232 |
+ my $patch_url = url_for("/$base_user_id/$base_project_id/pull/$issue->{row_id}.patch")->to_abs; |
|
229 | 233 |
|
230 | 234 |
my $pre_content_base = "git checkout -b $target_user_id-$target_branch $base_branch"; |
231 | 235 |
my $pre_content_http = "git pull $http_rep_url $target_branch"; |
... | ... |
@@ -252,11 +256,11 @@ |
252 | 256 |
$pull_title = ucfirst $pull_title; |
253 | 257 |
%> |
254 | 258 |
|
255 |
- <%= $pull_title %> <span style="color:#767676;">#<%= $pull_request->{row_id} %></span> |
|
259 |
+ <%= $pull_title %> <span style="color:#767676;">#<%= $issue->{row_id} %></span> |
|
256 | 260 |
</div> |
257 | 261 |
<div> |
258 | 262 |
<div style="display:inline-block;color:white;margin-right:4px;"> |
259 |
- % if ($pull_request->{open}) { |
|
263 |
+ % if ($issue->{open}) { |
|
260 | 264 |
<div style="background:#6cc644;padding:4px 8px;border-radius:3px;"> |
261 | 265 |
Open |
262 | 266 |
</div> |
... | ... |
@@ -266,7 +270,7 @@ |
266 | 270 |
</div> |
267 | 271 |
% } |
268 | 272 |
</div> |
269 |
- % my $open_user_id = $pull_request->{'__open_user.id'}; |
|
273 |
+ % my $open_user_id = $issue->{'__open_user.id'}; |
|
270 | 274 |
<a style="color:#333333;font-weight:bold" href="<%= url_for("/$open_user_id") %>"><%= $open_user_id %></a> |
271 | 275 |
<span style="color:#767676"> |
272 | 276 |
wants to merge <%= $commits_count %> commits |
... | ... |
@@ -308,7 +312,7 @@ |
308 | 312 |
</ul> |
309 | 313 |
<div class="pull-comment"> |
310 | 314 |
<div class="pull-comment-header"> |
311 |
- <b><%= $issue_message_first->{'__open_user.id'} %></b> |
|
315 |
+ <b><%= $issue_message_first->{'__user.id'} %></b> |
|
312 | 316 |
<span style="color:#767676"> |
313 | 317 |
commented |
314 | 318 |
<%= $api->age_string($issue_message_first->{update_time}) %> |
... | ... |
@@ -367,7 +371,7 @@ |
367 | 371 |
% } |
368 | 372 |
|
369 | 373 |
% if ($api->can_write_access($session_user_id, $base_user_id, $base_project_id)) { |
370 |
- % if ($commits_count && $merge_success && $pull_request->{open}) { |
|
374 |
+ % if ($commits_count && $merge_success && $issue->{open}) { |
|
371 | 375 |
<div class="pull-request-form"> |
372 | 376 |
<div style="overflow:hidden"> |
373 | 377 |
<div style="float:left;padding:10px;padding-right:0"> |
... | ... |
@@ -456,7 +460,7 @@ git push origin <%= $base_branch %> |
456 | 460 |
</div> |
457 | 461 |
% } |
458 | 462 |
|
459 |
- % if ($pull_request->{open}) { |
|
463 |
+ % if ($issue->{open}) { |
|
460 | 464 |
<div style="text-align:right;margin-top:10px;"> |
461 | 465 |
<form action="<%= url_for %>" method="post"> |
462 | 466 |
<%= hidden_field op => 'close' %> |