已是项目成员则之前的申请都改为拒绝

This commit is contained in:
yuanke 2016-08-11 11:13:37 +08:00
parent b8155cc1c2
commit 72a7a1e9f2
1 changed files with 4 additions and 0 deletions

View File

@ -149,6 +149,10 @@ class ProjectsService
if current_user.member_of?(project) #如果已经是成员
member = project.member_principals.includes(:roles, :principal).where("user_id=?",current_user.id).first
status = member.member_roles[0].role_id
#将之前的申请都改为已拒绝
applied_messages = AppliedMessage.where(:project_id => project.id, :status => 1, :applied_user_id=>current_user.id,:applied_type => "AppliedProject")
applied_messages.update_all(:status=>5)
else
if params[:invite_code].present?