[Bugfix]Fixes agent cannot be removed from inbox #18 (#304)

Closes #18
This commit is contained in:
Sojan Jose 2019-11-27 09:12:17 +05:30 committed by Sony Mathew
parent 17eed16dfe
commit c36b4279ac

View file

@ -10,7 +10,8 @@ module Api
begin begin
update_agents_list update_agents_list
head :ok head :ok
rescue StandardError rescue StandardError => e
Rails.logger.debug "Rescued: #{e.inspect}"
render_could_not_create_error('Could not add agents to inbox') render_could_not_create_error('Could not add agents to inbox')
end end
else else
@ -31,7 +32,7 @@ module Api
# the new ones are the agents which are to be added to the inbox # 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_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 end
def agents_to_be_added_ids def agents_to_be_added_ids
@ -43,7 +44,7 @@ module Api
end end
def current_agents_ids def current_agents_ids
@current_agents_ids = @inbox.members.pluck(:user_id) @current_agents_ids = @inbox.members.pluck(:id)
end end
def fetch_inbox def fetch_inbox