diff --git a/app/models/form/lettings/questions/created_by_id.rb b/app/models/form/lettings/questions/created_by_id.rb index 4ed1efdd5..b2516808e 100644 --- a/app/models/form/lettings/questions/created_by_id.rb +++ b/app/models/form/lettings/questions/created_by_id.rb @@ -19,8 +19,14 @@ class Form::Lettings::Questions::CreatedById < ::Form::Question users = [] users += if current_user.support? [ - (log.owning_organisation&.users if log.owning_organisation), - (log.managing_organisation&.users if log.managing_organisation), + ( + if log.owning_organisation + log.owning_organisation.absorbing_organisation.present? ? log.owning_organisation&.absorbing_organisation&.users : log.owning_organisation&.users + end), + ( + if log.managing_organisation + log.managing_organisation.absorbing_organisation.present? ? log.managing_organisation&.absorbing_organisation&.users : log.managing_organisation.users + end), ].flatten else current_user.organisation.users diff --git a/app/models/form/sales/questions/created_by_id.rb b/app/models/form/sales/questions/created_by_id.rb index 44b64184e..e48b4f9e5 100644 --- a/app/models/form/sales/questions/created_by_id.rb +++ b/app/models/form/sales/questions/created_by_id.rb @@ -17,8 +17,17 @@ class Form::Sales::Questions::CreatedById < ::Form::Question return ANSWER_OPTS unless log.owning_organisation return ANSWER_OPTS unless current_user - users = current_user.support? ? log.owning_organisation.users : current_user.organisation.users - + users = [] + users += if current_user.support? + [ + ( + if log.owning_organisation + log.owning_organisation.absorbing_organisation.present? ? log.owning_organisation&.absorbing_organisation&.users : log.owning_organisation&.users + end), + ].flatten + else + current_user.organisation.users + end.uniq.compact users.each_with_object(ANSWER_OPTS.dup) do |user, hsh| hsh[user.id] = present_user(user) hsh