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