|
|
|
@@ -65,13 +65,13 @@ class MembersController < ApplicationController |
|
|
|
|
|
|
|
def check_member_exists! |
|
|
|
@current_user_header_team = Team.joins(:team_users, :team_projects).where(team_projects: {project_id: @project.id}, team_users: {user_id: current_user.id}).order(authorize: :desc).take |
|
|
|
return render_error("user_id为#{params[:user_id]}的用户已经是项目成员") if member_exists? || (params[:user_id].to_i == current_user.id && @current_user_header_team.present?) |
|
|
|
return render_error("#{@user&.nickname}已经是项目成员") if member_exists? || (params[:user_id].to_i == current_user.id && @current_user_header_team.present?) |
|
|
|
end |
|
|
|
|
|
|
|
def check_member_not_exists! |
|
|
|
@current_user_header_team = Team.joins(:team_users, :team_projects).where(team_projects: {project_id: @project.id}, team_users: {user_id: current_user.id}).order(authorize: :desc).take |
|
|
|
return render_error("用户为组织成员,请到组织下操作!") if (params[:user_id].to_i == current_user.id && @current_user_header_team.present?) && !member_exists? |
|
|
|
return render_error("user_id为#{params[:user_id]}的用户还不是项目成员") unless member_exists? |
|
|
|
return render_error("#{@user&.nickname}还不是项目成员") unless member_exists? |
|
|
|
end |
|
|
|
|
|
|
|
def check_user_profile_completed |
|
|
|
|