From c36b4279ace00b036fc2f89832374e9adff4bad4 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Wed, 27 Nov 2019 09:12:17 +0530 Subject: [PATCH] [Bugfix]Fixes agent cannot be removed from inbox #18 (#304) Closes #18 --- app/controllers/api/v1/inbox_members_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/inbox_members_controller.rb b/app/controllers/api/v1/inbox_members_controller.rb index 6bf6f7748..f5e8a6a10 100644 --- a/app/controllers/api/v1/inbox_members_controller.rb +++ b/app/controllers/api/v1/inbox_members_controller.rb @@ -10,7 +10,8 @@ module Api begin update_agents_list head :ok - rescue StandardError + rescue StandardError => e + Rails.logger.debug "Rescued: #{e.inspect}" render_could_not_create_error('Could not add agents to inbox') end else @@ -31,7 +32,7 @@ module Api # the new ones are the agents which are to be added to the inbox agents_to_be_added_ids.each { |user_id| @inbox.add_member(user_id) } - agents_to_be_removed_ids.each { |_user_id| @inbox.remove_member(user) } + agents_to_be_removed_ids.each { |user_id| @inbox.remove_member(user_id) } end def agents_to_be_added_ids @@ -43,7 +44,7 @@ module Api end def current_agents_ids - @current_agents_ids = @inbox.members.pluck(:user_id) + @current_agents_ids = @inbox.members.pluck(:id) end def fetch_inbox