From c3a27151ca0fb54f2400cfa934749db7b3c0f773 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Fri, 27 Nov 2015 15:21:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=5Frevision?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_revisions.html.erb | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index 50c973fb4..b72a05876 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -1,16 +1,16 @@ <%= form_tag( {:controller => 'repositories', :action => 'diff', :id => project, :repository_id => @repository.identifier_param, :path => to_path_param(path)}, - :method => :get + :method => :get ) do %> - - - - - - + + + + + + @@ -24,6 +24,7 @@ <%= textilizable(truncate_at_line_break(changeset.message)) %> +
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
@@ -31,13 +32,29 @@
- - <%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %> - <%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %> - 提交于 -
-   -
+ <% if !user_commit_rep(changeset.author_email).nil? %> + + <%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %> + <%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %> + 提交于 +
+ +   +
+ <% else %> + <%= changeset.author_email %> + 提交于 +
+ +   +
+ <% end %> + +
@@ -50,7 +67,7 @@

<% end %> From e9caf0980a644ec62739b16facdee31e318ed1b0 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Fri, 27 Nov 2015 17:57:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E7=94=A8=E6=88=B7sync=5F?= =?UTF-8?q?gitlab=5Fuser=EF=BC=8C=E5=8A=A0=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_gitlab_user.rake | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/tasks/sync_gitlab_user.rake b/lib/tasks/sync_gitlab_user.rake index c932ca36c..fb84f5f08 100644 --- a/lib/tasks/sync_gitlab_user.rake +++ b/lib/tasks/sync_gitlab_user.rake @@ -6,24 +6,30 @@ namespace :gitlab do users = User.find_by_sql("select * from users where gid is null") s = Trustie::Gitlab::Sync.new g = Gitlab.client + logger = Logger.new('./log/add_gid.log', 'daily') #按天生成 users.each do |user| - us = g.get("/users?search=#{user.mail}") - puts user.mail - if us.blank? - puts "55555555555555555" - s.sync_user(user) - else - # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com - puts "66666666666666666666" - puts user.id - if Array === us - us.each do |u| - if u.email == user.mail - user.gid = u.id - user.save + begin + us = g.get("/users?search=#{user.mail}") + puts user.mail + if us.blank? + puts "55555555555555555" + s.sync_user(user) + else + # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com + puts "66666666666666666666" + puts user.id + if Array === us + us.each do |u| + if u.email == user.mail + user.gid = u.id + user.save + end end end end + rescue => e + logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}") + puts e end end end