Showing 3 changed files with 34 additions and 8 deletions
+2
CHANGES
... ...
@@ -4,6 +4,8 @@
4 4
   - fix "New pull request" button link
5 5
   - add "compare across forks" button in compare page
6 6
   - fix pull request error bug when already pull request exists.
7
+  - fix compare page bug
8
+  - fix pulls page bug
7 9
 2.3.1 (2016-08-12)
8 10
   - prevent XSS attack in issue and pull request message
9 11
 2.3 (2016-08-06)
+20
templates/compare.html.ep
... ...
@@ -36,6 +36,26 @@
36 36
     $target_branch = $user_id_and_target_branch // $base_branch;
37 37
     $target_project = $base_project
38 38
   }
39
+
40
+=pod
41
+  # Already pull request exists
42
+  my $pull_request_already = app->dbi->model('pull_request')->select(
43
+    where => {
44
+      base_project => $base_project->{row_id},
45
+      base_branch => $base_branch,
46
+      target_project => $target_project->{row_id},
47
+      target_branch => $target_branch
48
+    }
49
+  )->one;
50
+  if ($pull_request_already) {
51
+    my $issue = app->dbi->model('issue')->select(
52
+      where => {
53
+        project => $base_project->{row_id},
54
+        pull_request => $pull_request_already->{row_id}
55
+      }
56
+    )->one;
57
+  }
58
+=cut
39 59
   
40 60
   # Git
41 61
   my $git = $self->app->git;
+12 -8
templates/pulls.html.ep
... ...
@@ -13,25 +13,29 @@
13 13
   # Git
14 14
   my $git = $self->app->git;
15 15
   
16
+  my $project_row_id = $api->get_project_row_id($user_id, $project_id);
17
+  
16 18
   # Issues which have pull request
19
+  my $issue_where = [
20
+    ['and', ':issue.open{=}', ':pull_request{<>}', ':project{=}'],
21
+    {'issue.open' => $open, pull_request => 0, project => $project_row_id}
22
+  ];
23
+  
17 24
   my $issues = app->dbi->model('issue')->select(
18 25
     [
19 26
       {__MY__ => '*'},
20 27
       {open_user => ['id']},
21 28
       {pull_request => ['target_branch']}
22 29
     ],
23
-    where => [
24
-      ['and', ':issue.open{=}', ':pull_request{<>}', ':project.id{=}'],
25
-      {'issue.open' => $open, pull_request => 0, 'project.id' => $project_id}
26
-    ]
30
+    where => $issue_where
27 31
   )->all;
28 32
   
29 33
   # Open count
30 34
   my $open_count = app->dbi->model('issue')->select(
31 35
     'count(*)',
32 36
     where => [
33
-      ['and', ':issue.open{=}', ':pull_request{<>}', ':project.id{=}'],
34
-      {'issue.open' => 1, pull_request => 0, 'project.id' => $project_id}
37
+      ['and', ':issue.open{=}', ':pull_request{<>}', ':project{=}'],
38
+      {'issue.open' => 1, pull_request => 0, project => $project_row_id}
35 39
     ]
36 40
   )->value;
37 41
   
... ...
@@ -39,8 +43,8 @@
39 43
   my $close_count = app->dbi->model('issue')->select(
40 44
     'count(*)',
41 45
     where => [
42
-      ['and', ':issue.open{=}', ':pull_request{<>}', ':project.id{=}'],
43
-      {'issue.open' => 0, pull_request => 0, 'project.id' => $project_id}
46
+      ['and', ':issue.open{=}', ':pull_request{<>}', ':project{=}'],
47
+      {'issue.open' => 0, pull_request => 0, project => $project_row_id}
44 48
     ]
45 49
   )->value;
46 50