退出项目的时候清楚申请信息

This commit is contained in:
huang 2016-07-29 23:23:04 +08:00
parent 21eed9ebb3
commit 07ff420a6a
1 changed files with 5 additions and 0 deletions

View File

@ -792,6 +792,11 @@ class ProjectsController < ApplicationController
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
if members != nil && members.roles.first.to_s != "Manager"
members.destroy
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => members.user_id).first
unless applied_projects.nil?
applied_projects.delete
end
end
respond_to do |format|
format.js