public questions

This commit is contained in:
txz 2016-07-01 20:00:23 +08:00
parent 67cad6fc25
commit 8cc4b7a878
1 changed files with 6 additions and 4 deletions

View File

@ -653,12 +653,14 @@ class ProjectsController < ApplicationController
def update
@project.safe_attributes = params[:project]
@project.organization_id = params[:organization_id]
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0
params[:project][:is_public] == "on" ? @project.is_public = 1 : @project.is_public = 0
params[:project][:hidden_repo] == "on" ? @project.hidden_repo = 1 : @project.hidden_repo = 0
# 更新公开私有时同步gitlab公开私有
if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? true : false)
if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? 1 : 0)
logger.info("########################=>#{params[:project][:is_public]}")
g = Gitlab.client
params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
params[:project][:is_public] == "on" ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
logger.info("88888888888888888888888=>#{params[:project][:is_public] == "on"}")
end
# end
if validate_parent_id && @project.save