diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8a871e2ea..089333160 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -44,6 +44,13 @@ module ApplicationHelper user.nil? ? User.find(2) : user end + # 历史数据(老版本库数据)处理完则可以修改该放放 + def get_rep_identifier_by_project project + identifier = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first.try(:identifier) + result = identifier.nil? ? Repository.where(:project_id => project.id).first.try(:identifier) : identifier + result + end + # 获取用户单位 # 优先获取高校信息,如果改信息不存在则获取occupation def get_occupation_from_user user diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index 658f9f4f0..2e119ed7c 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -73,7 +73,7 @@ <% when "Attachment" %> <%= render :partial => 'users/project_attachment', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %> <% when "Commit" %> - <%= render :partial => 'projects/project_commit', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %> + <%= render :partial => 'projects/project_commit', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :identifier => get_rep_identifier_by_project(@project) } %> <% end %> <% end %> <% end %> diff --git a/app/views/projects/_project_commit.html.erb b/app/views/projects/_project_commit.html.erb index 99998e6e1..eea981a9d 100644 --- a/app/views/projects/_project_commit.html.erb +++ b/app/views/projects/_project_commit.html.erb @@ -17,7 +17,7 @@ <%= link_to project.to_s+" | 项目代码提交", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %>
- <%= link_to activity.comments, {:controller => 'repositories', :action => 'commit_diff', :id => project.id, :changeset => activity.version}, :class => "postGrey" %> + <%= link_to activity.comments, {:controller => 'repositories', :action => 'commit_diff', :id => project.id, :repository_id => identifier, :changeset => activity.version}, :class => "postGrey" %>
提交时间:<%= format_time(activity.committed_on) %>