diff --git a/app/controllers/stash_api/datasets_controller.rb b/app/controllers/stash_api/datasets_controller.rb index 3a474a6a1..90b99e4f1 100644 --- a/app/controllers/stash_api/datasets_controller.rb +++ b/app/controllers/stash_api/datasets_controller.rb @@ -582,6 +582,7 @@ def duplicate_resource nr.current_editor_id = @user.id nr.save! rescue ActiveRecord::RecordNotUnique + @resource.identifier.reload nr = @resource.identifier.latest_resource unless @resource.identifier.latest_resource_id == @resource.id nr ||= @resource.amoeba_dup nr.current_editor_id = @user.id diff --git a/app/helpers/stash_engine/metadata_entry_pages_helper.rb b/app/helpers/stash_engine/metadata_entry_pages_helper.rb index da887cf73..b06f34d5c 100644 --- a/app/helpers/stash_engine/metadata_entry_pages_helper.rb +++ b/app/helpers/stash_engine/metadata_entry_pages_helper.rb @@ -6,6 +6,7 @@ def duplicate_resource @new_res.current_editor_id = current_user&.id @new_res.save! rescue ActiveRecord::RecordNotUnique + @resource.identifier.reload @new_res = @resource.identifier.latest_resource unless @resource.identifier.latest_resource_id == @resource.id @new_res ||= @resource.amoeba_dup @new_res.current_editor_id = current_user&.id