diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f3ba6f76c..d8c174bc3 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -306,7 +306,7 @@ class ProjectsController < ApplicationController if User.current.member_of?(@project) || User.current.admin? case params[:type] when nil - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment','Commit')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'issue' @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10) when 'news' @@ -320,7 +320,7 @@ class ProjectsController < ApplicationController @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10); end - # g = Gitlab.client + # 版本库统计图 unless @project.gpid.nil? || @project.project_score.changeset_num == 0 # rep_statics_commit = @project.rep_statics.order("commits_num desc") rep_statics_commit = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by commits_num desc limit 10") diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 42a3491fb..8a871e2ea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -38,6 +38,12 @@ module ApplicationHelper # super # end + # 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换 + def get_user_by_mail mail + user = User.find_by_mail(mail) + user.nil? ? User.find(2) : user + 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 6322a532a..658f9f4f0 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -72,23 +72,8 @@ <% when "Attachment" %> <%= render :partial => 'users/project_attachment', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %> - - - - - - - - - <%#= link_to format_activity_title("#{l(:label_attachment)}: #{act.filename}"), {:controller => 'attachments', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %> - - - - - - - - + <% when "Commit" %> + <%= render :partial => 'projects/project_commit', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %> <% end %> <% end %> <% end %> diff --git a/app/views/projects/_project_commit.html.erb b/app/views/projects/_project_commit.html.erb new file mode 100644 index 000000000..99998e6e1 --- /dev/null +++ b/app/views/projects/_project_commit.html.erb @@ -0,0 +1,28 @@ +<% project = Project.find(activity.project_id) %> +<% user = get_user_by_mail(activity.committer) %> +