From 27ad49282c442e89898af2dce7fb186b4021cf2f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 27 Sep 2014 16:43:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=B1=82=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=80=80=E5=87=BA=E9=A1=B9=E7=9B=AE=E7=9A=84=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/views/layouts/_join_exit_project.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c40ac384a..6770d0c02 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -898,7 +898,7 @@ class ProjectsController < ApplicationController @project = Project.find params[:id] if User.current.login? members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first - if members != nil + if members != nil && members.roles.first.to_s != "Manager" members.destroy end respond_to do |format| diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 310d4ecd3..a2b928e15 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -16,7 +16,7 @@
<% if ((User.current.member_of? @project) && User.current.login? && - @project.members.where("user_id = #{User.current.id}").first.roles.first.to_s != "Manager") %> + Member.where(:user_id => User.current.id, :project_id=>@project.id).first.roles.first.to_s != "Manager") %> <%= exit_project_link(@project) %> <% end %>
\ No newline at end of file