Merge branch '20470-contents-select' refs #20470
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 5 May 2023 17:33:57 +0000 (13:33 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 5 May 2023 17:33:57 +0000 (13:33 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

1  2 
services/api/app/controllers/arvados/v1/containers_controller.rb

index ceb40348bbdfc723c30a5e9f99a76d0132ff6fe1,acb61c6e608898ec864bfccadb3f50d9bb04fde8..17970ce4cd271c13d6f66c2ee59b1a04da76ce3a
@@@ -51,10 -50,17 +51,16 @@@ class Arvados::V1::ContainersControlle
      if action_name == 'lock' || action_name == 'unlock'
        # Avoid loading more fields than we need
        @objects = @objects.select(:id, :uuid, :state, :priority, :auth_uuid, :locked_by_uuid, :lock_count)
-       @select = %w(uuid state priority auth_uuid locked_by_uuid)
+       # This gets called from within find_object_by_uuid.
+       # find_object_by_uuid stores the original value of @select in
+       # @preserve_select, edits the value of @select, calls
+       # find_objects_for_index, then restores @select from the value
+       # of @preserve_select.  So if we want our updated value of
+       # @select here to stick, we have to set @preserve_select.
+       @select = @preserve_select = %w(uuid state priority auth_uuid locked_by_uuid)
      elsif action_name == 'update_priority'
 -      # We're going to reload(lock: true) in the handler, which will
 -      # select all attributes, but will fail if we don't select :id
 -      # now.
 +      # We're going to reload in update_priority!, which will select
 +      # all attributes, but will fail if we don't select :id now.
        @objects = @objects.select(:id, :uuid)
      end
    end