From 3ec5a7991f90eb20e495e4c022cf779c4d9048a7 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 26 Sep 2017 15:47:31 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=B7=B2=E5=8F=91=E5=B8=83=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=A6=82=E6=9E=9C=E4=BF=AE=E6=94=B9=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E7=9A=84=E2=80=9C=E6=8A=80=E6=9C=AF=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E2=80=9D=E4=B8=8D=E8=A7=A6=E5=8F=91=E5=BC=BA=E5=88=B6=E9=87=8D?= =?UTF-8?q?=E7=BD=AE?= 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 799dac04f..3dd01f27c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -721,7 +721,7 @@ class ShixunsController < ApplicationController ActiveRecord::Base.transaction do begin @shixun.save! - if language != params[:language] + if language != params[:language] && @shixun.status != 2 # 已发布不触发重置 add_shixun_modify_status(@shixun, 1) end rescue From 76cd81ec8e20a82cfa9ea0d4e065c58d20e63663 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 Sep 2017 11:11:15 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 4 ++++ app/views/shixuns/_shixun_top.html.erb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 3dd01f27c..be7308a49 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -546,6 +546,10 @@ class ShixunsController < ApplicationController end def copy + unless (@shixun.can_copy && User.current.user_extensions.try(:identity) == 1 && User.current.professional_certification) + render_403 + return + end ActiveRecord::Base.transaction do begin new_shixun = Shixun.new diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index 1c8c75159..9c7b2384b 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -35,7 +35,7 @@ <% end %> 已关闭 <% end %> - <% if @shixun.can_copy %> + <% if @shixun.can_copy && User.current.user_extensions.try(:identity) == 1 && User.current.professional_certification %> <%#= link_to "复制", copy_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15" %> 复制 <% end %> From 3ce5368a9ad5aa497c08120ddb25f52ef41590b5 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 Sep 2017 11:29:05 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=80=81=E5=B8=88=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- app/views/shixuns/_shixun_top.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index be7308a49..4e09bf44c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -546,7 +546,7 @@ class ShixunsController < ApplicationController end def copy - unless (@shixun.can_copy && User.current.user_extensions.try(:identity) == 1 && User.current.professional_certification) + unless (@shixun.can_copy && User.current.user_extensions.try(:identity) == 0 && User.current.professional_certification) render_403 return end diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index 9c7b2384b..8566e7a81 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -35,7 +35,7 @@ <% end %> 已关闭 <% end %> - <% if @shixun.can_copy && User.current.user_extensions.try(:identity) == 1 && User.current.professional_certification %> + <% if @shixun.can_copy && User.current.user_extensions.try(:identity) == 0 && User.current.professional_certification %> <%#= link_to "复制", copy_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15" %> 复制 <% end %> From fad2fb478f72a1535ae6c44eee751d4d653253d0 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 Sep 2017 14:12:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97=E5=8C=BA?= =?UTF-8?q?=E5=88=86?= 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 4e09bf44c..efc80c87a 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -578,7 +578,7 @@ class ShixunsController < ApplicationController gshixun = g.fork(@shixun.gpid, user_gid) raise "版本库创建失败" if gshixun.try(:id).blank? gshixun = g.edit_project(gshixun.id, new_shixun.identifier, new_shixun.identifier) - raise "版本库创建失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier) + raise "实训复制失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier) new_shixun.update_column(:gpid, gshixun.id) # 同步复制合作者,合作者加入到gitlab