diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index decfe154c..f7cfa32c9 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -547,6 +547,10 @@ class ShixunsController < ApplicationController end def copy + unless (@shixun.can_copy && User.current.user_extensions.try(:identity) == 0 && User.current.professional_certification) + render_403 + return + end ActiveRecord::Base.transaction do begin new_shixun = Shixun.new @@ -575,7 +579,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 @@ -722,7 +726,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 diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index ff3415123..f63f43429 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -37,7 +37,7 @@ <% end %> 已关闭 <% end %> - <% if @shixun.can_copy %> + <% 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 %>