修复当前用户为超级管理员时,创建项目后,在个人信息的参与项目栏内无该项目的记录

This commit is contained in:
sw 2014-07-14 14:49:05 +08:00
parent 31245f6fb2
commit ef95835bc6
1 changed files with 10 additions and 9 deletions

View File

@ -574,10 +574,11 @@ class ProjectsController < ApplicationController
end
end
else
#@project.memberships.create
if validate_parent_id && @project.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
# Add current user as a project member if he is not admin
unless User.current.admin?
#unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
@ -587,7 +588,7 @@ class ProjectsController < ApplicationController
end
@project.members << m
@project.project_infos << project
end
#end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)