From 2b99918b262801c57dd93e19d217598ab88731ac Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Wed, 27 Jan 2021 12:16:49 -0500 Subject: [PATCH] Group admins can't leave by clicking 'member' button --- app/controllers/api/v1/groups/accounts_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/groups/accounts_controller.rb b/app/controllers/api/v1/groups/accounts_controller.rb index c3ed3d20..5224c944 100644 --- a/app/controllers/api/v1/groups/accounts_controller.rb +++ b/app/controllers/api/v1/groups/accounts_controller.rb @@ -47,12 +47,12 @@ class Api::V1::Groups::AccountsController < Api::BaseController @join_request.destroy_all else authorize @group, :leave? - GroupAccount.where(group: @group, account_id: current_account.id).destroy_all + GroupAccount.where(group: @group, account_id: current_account.id, role: nil).destroy_all end render json: @group, serializer: REST::GroupRelationshipSerializer, relationships: relationships end - + private def relationships