Reduce line code to please Rubocop (#111)

Fixes #58
This commit is contained in:
Ian Vaughan 2019-10-03 23:57:34 +01:00 committed by Sojan Jose
parent e2448c5ece
commit ccfa135264

View file

@ -10,12 +10,8 @@ class Api::V1::InboxMembersController < Api::BaseController
# the new ones are the agents which are to be added to the inbox
if @inbox
begin
agents_to_be_added_ids.each do |user_id|
@inbox.add_member(user_id)
end
agents_to_be_removed_ids.each do |user_id|
@inbox.remove_member(user)
end
add_agents
remove_agents
head :ok
rescue => e
render_could_not_create_error("Could not add agents to inbox")
@ -31,6 +27,18 @@ class Api::V1::InboxMembersController < Api::BaseController
private
def add_agents
agents_to_be_added_ids.each do |user_id|
@inbox.add_member(user_id)
end
end
def remove_agents
agents_to_be_removed_ids.each do |user_id|
@inbox.remove_member(user)
end
end
def agents_to_be_added_ids
params[:user_ids] - @current_agents_ids
end