更改:private传值问题

This commit is contained in:
yystopf 2024-03-21 11:25:05 +08:00
parent d6acce86a7
commit bf7289032a
1 changed files with 3 additions and 2 deletions

View File

@ -203,8 +203,9 @@ class ProjectsController < ApplicationController
:project_category_id, :project_language_id, :private, :identifier)
Projects::UpdateForm.new(validate_params.merge(user_id: @project.user_id, project_identifier: @project.identifier, project_name: @project.name)).validate!
private = @project.forked_from_project.present? ? !@project.forked_from_project.is_public : params[:private] || !@project.is_public
private = params[:private].nil? ? !@project.is_public : params[:private]
private = @project.forked_from_project.present? ? !@project.forked_from_project.is_public : private
new_project_params = project_params.except(:private).merge(is_public: !private)
@project.update_attributes!(new_project_params)