lib/eco/api/usecases/default_cases/create_case.rb in eco-helpers-0.7.1 vs lib/eco/api/usecases/default_cases/create_case.rb in eco-helpers-0.7.2
- old
+ new
@@ -6,11 +6,11 @@
def process
@cases.define("create", type: :sync) do |entries, people, session, options|
creation = session.job_group("main").new("create", type: :create, sets: [:core, :details, :account])
- strict_search = session.config.people.strict_search? || options.dig(:search, :strict)
+ strict_search = session.config.people.strict_search? && (!options[:search]&.key?(:strict) || options.dig(:search, :strict))
pgs = session.policy_groups
entries.each.with_index do |entry, i|
if person = people.find(entry, strict: strict_search)
session.logger.error("Entry(#{i}) - this person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}")
@@ -23,10 +23,10 @@
unless options.dig(:exclude, :account)
ini_pg_ids = person.account&.policy_group_ids || []
ini_tags = person.account&.filter_tags || []
entry.set_account(person)
- person.account.send_invites = false if options.key?(:send_invites) && !options(:send_invites)
+ person.account&.send_invites = options[:send_invites] if options.key?(:send_invites)
person.account.policy_group_ids = pgs.user_pg_ids(
initial: ini_pg_ids,
final: person.account.policy_group_ids
)