Showing 1 changed files with 7 additions and 16 deletions
+7 -16
templates/commits.html.ep
... ...
@@ -15,19 +15,8 @@
15 15
   my ($rev, $file) = $git->parse_rev_path(app->rep_info($user, $project), $rev_file);
16 16
   my $page = param('page') || 0;
17 17
   
18
-  # Commit
19
-  my $commit = $git->get_commit(app->rep_info($user, $project), $rev);
20
-
21
-  # Not found
22
-  unless ($commit) {
23
-    $self->reply->not_found;
24
-    return;
25
-  }
26
-  my $commit_author_email = $commit->{author_email};
27
-  my $commit_author_id = app->dbi->model('user')->select(
28
-    'id',
29
-    where => {email => $commit_author_email}
30
-  )->value;
18
+  # Latest commit
19
+  my $latest_commit = $git->get_commit(app->rep_info($user, $project), $rev);
31 20
 
32 21
   # Authors
33 22
   my %author_id_of = map { $_->{email} => $_->{id} }
... ...
@@ -37,7 +26,7 @@
37 26
   my $page_count = 30;
38 27
   my $commits = $git->get_commits(
39 28
     app->rep_info($user, $project),
40
-    $commit->{id},
29
+    $latest_commit->{id},
41 30
     $page_count,
42 31
     $page_count * $page,
43 32
     $file
... ...
@@ -140,6 +129,8 @@
140 129
           <ul class="commits-date-container">
141 130
             % my $num = 0;
142 131
             % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) {
132
+              <%
133
+                my $author_id = app->dbi->model('user')->select('id', where => {email => $commit->{author_email}})->value;              %>
143 134
               <li>
144 135
                 <div class="commit-left">
145 136
                   <div class="commit-left-title">
... ...
@@ -149,8 +140,8 @@
149 140
                   </div>
150 141
                   <div class="commit-left-author">
151 142
                     <span title="<%= $commit->{author_email} %>">
152
-                      % my $author_id = $author_id_of{ $commit->{author_email} };
153
-                      % if ($author_id) {
143
+                    
144
+                      % if (defined $author_id) {
154 145
                         <a href="<%= url_for("/$author_id") %>"><%= $author_id %></a>
155 146
                       % } else {
156 147
                         <%= $commit->{author_name} %>