From 99e6e1df60c676adc85586d0a7d5355af875a78e Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 17 Aug 2017 14:36:04 +0800
Subject: [PATCH 1/4] =?UTF-8?q?webssh=E9=AB=98=E5=BA=A6=E5=8F=AA=E9=80=82?=
=?UTF-8?q?=E5=BA=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/games/_repository.html.erb | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/app/views/games/_repository.html.erb b/app/views/games/_repository.html.erb
index 0b393bb9c..03f65361a 100644
--- a/app/views/games/_repository.html.erb
+++ b/app/views/games/_repository.html.erb
@@ -89,13 +89,15 @@
if(data.error){
return;
}else{
- // 测试版
- var html = "
";
- // 本地版
- var html_local ="";
- $("#codetab_con_2").html(html);
- var h = $("#games_repository_contents").height() - $("#top_repository").height() - 10;
+ var h = $("#games_repository_contents").height() - $("#top_repository").height() - 10;
+ var rows = parseInt(h / 18);
$("#game_webssh").css("min-height", h);
+ // 测试版
+ var html = "";
+ // 本地版
+ var html_local ="";
+ $("#codetab_con_2").html(html);
+
HoverLi_new(2);
// console.log( $("#game_webssh").contentDocument.body.height());
From 62aa1e28c61e8b085d702f799db9d036fbb0e487 Mon Sep 17 00:00:00 2001
From: huang
Date: Thu, 17 Aug 2017 16:08:48 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=90=88=E4=BD=9C?=
=?UTF-8?q?=E8=80=85=E6=B7=BB=E5=8A=A0=E6=8C=89=E2=80=9Dlogin=E2=80=9C?=
=?UTF-8?q?=E2=80=9Dmail=E2=80=9C=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index a5e9be1f0..b7f035888 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -177,7 +177,7 @@ class ShixunsController < ApplicationController
# members = searchTeacherAndAssistant @course
member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")"
condition = "%#{params[:search].strip}%".gsub(" ","")
- @users = User.where("id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname)) LIKE '#{condition}'").includes(:user_extensions)
+ @users = User.where("id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname, login, mail)) LIKE '#{condition}'").includes(:user_extensions)
end
respond_to do |format|
format.js
From f2fe59ed0fc2ace704b2fa45cfd6bc6c4a10d808 Mon Sep 17 00:00:00 2001
From: huang
Date: Thu, 17 Aug 2017 17:18:30 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E8=AE=AD?=
=?UTF-8?q?=E5=90=88=E4=BD=9C=E8=80=85=EF=BC=8C=E6=95=B0=E6=8D=AE=E5=90=8C?=
=?UTF-8?q?=E6=AD=A5github?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 31 ++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index b7f035888..9adddf597 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -184,17 +184,38 @@ class ShixunsController < ApplicationController
end
end
+ # 事务处理,保证Trustie与Gitlab数据同步
def shixun_members_added
unless params[:membership][:user_ids].blank?
memberships = params[:membership][:user_ids]
memberships.each do |member|
- ShixunMember.create(:user_id => member, :shixun_id => @shixun.id, :role => 2)
+ ActiveRecord::Base.transaction do
+ begin
+ user = User.find(member)
+ s = Trustie::Gitlab::Sync.new
+ if user.gid.present?
+ gid = user.gid
+ else
+ guser = s.sync_user(user)
+ gid = guser.id
+ end
+ ShixunMember.create(:user_id => member, :shixun_id => @shixun.id, :role => 2)
+ u = s.g.add_team_member(@shixun.gpid, gid, 40) # 3代表角色master
+ if u.blank?
+ raise("同步Gitlab数据错误")
+ end
+ @collaborators = @shixun.collaborators
+ respond_to do |format|
+ format.js
+ end
+ rescue Exception => e
+ logger.error(e)
+ raise ActiveRecord::Rollback
+ end
+ end
end
@collaborators = @shixun.collaborators
end
- respond_to do |format|
- format.js
- end
end
def search
@@ -619,7 +640,7 @@ class ShixunsController < ApplicationController
# REDO: 新增类型copy的时候
# 复制项目
# gshixun --> gitlab project
- CODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
+ # CODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
def copy_myshixun shixun, gshixun
myshixun = Myshixun.new
# myshixun.attributes = shixun.attributes.dup.except("id","user_id","visits","gpid","status", "identifier","propaedeutics")
From 7ec2cf834f6446584b4922b6f8a5e28dfe336fb3 Mon Sep 17 00:00:00 2001
From: huang
Date: Thu, 17 Aug 2017 17:27:35 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E5=91=98?=
=?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=90=8C=E6=AD=A5gitlab=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 9adddf597..f1fc110a4 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -163,8 +163,13 @@ class ShixunsController < ApplicationController
def collaborators_delete
user_id = params[:c_id]
+ gid = User.find(user_id).try(:gid)
shixun_member = ShixunMember.where(:user_id => user_id, :shixun_id => @shixun.id, :role => 2).first
shixun_member.delete
+ g = Gitlab.client
+ unless gid.nil?
+ g.remove_team_member(@shixun.gpid, gid)
+ end
@collaborators = @shixun.collaborators
respond_to do |format|
format.js