@@ -10,12 +10,8 @@ class Api::V1::InboxMembersController < Api::BaseController
|
|||||||
# 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
|
||||||
if @inbox
|
if @inbox
|
||||||
begin
|
begin
|
||||||
agents_to_be_added_ids.each do |user_id|
|
add_agents
|
||||||
@inbox.add_member(user_id)
|
remove_agents
|
||||||
end
|
|
||||||
agents_to_be_removed_ids.each do |user_id|
|
|
||||||
@inbox.remove_member(user)
|
|
||||||
end
|
|
||||||
head :ok
|
head :ok
|
||||||
rescue => e
|
rescue => e
|
||||||
render_could_not_create_error("Could not add agents to inbox")
|
render_could_not_create_error("Could not add agents to inbox")
|
||||||
@@ -31,6 +27,18 @@ class Api::V1::InboxMembersController < Api::BaseController
|
|||||||
|
|
||||||
private
|
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
|
def agents_to_be_added_ids
|
||||||
params[:user_ids] - @current_agents_ids
|
params[:user_ids] - @current_agents_ids
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user