修改gitlab tree返回类型(lastrev)

This commit is contained in:
huang 2016-10-09 09:30:20 +08:00
parent c03384f122
commit 45d8e64840
4 changed files with 6 additions and 5 deletions

View File

@ -382,7 +382,8 @@ update
if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
@changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0]
@changesets_latest_coimmit = @g.commit(@project.gpid, @entries.first.try(:lastrev))
# @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0]
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count

View File

@ -422,8 +422,8 @@ class Repository < ActiveRecord::Base
def load_entries_changesets(entries)
if entries
entries.each do |entry|
if entry.lastrev && entry.lastrev.identifier
entry.changeset = find_changeset_by_name(entry.lastrev.identifier)
if entry.lastrev
entry.changeset = entry.lastrev
end
end
end

View File

@ -49,7 +49,7 @@
<div class="cl"></div>
<div class="recordBanner mt10" style="width:730px;">
<% if @changesets && !@changesets.empty? %>
<% if @changesets_latest_coimmit %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>

View File

@ -96,7 +96,7 @@ module Redmine
:path => File.join(path,tree.name),
:kind => tree.type == 'tree' ? 'dir' : 'file',
:size => nil,
:lastrev => nil
:lastrev => tree.commit_id
})
end
entries.sort_by_name