diff options
author | Starfall <us@starfall.systems> | 2022-11-28 16:41:29 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2022-11-28 16:41:29 -0600 |
commit | cb9dad90b01c9f53d1910cf128eb22200bdb9884 (patch) | |
tree | 1935d74f49853ed371e36cfac2d44ac33d2e8a2e /app/validators | |
parent | c3c3b6953f37462f26f011b6c6cbd1655d5dcbea (diff) | |
parent | 1a7aa37b60769a10077c585fa76ec848b6866d9a (diff) |
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/admin_import_validator.rb | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/app/validators/admin_import_validator.rb b/app/validators/admin_import_validator.rb deleted file mode 100644 index 338ceb3a7..000000000 --- a/app/validators/admin_import_validator.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AdminImportValidator < ActiveModel::Validator - FIRST_HEADER = '#domain' - - def validate(import) - return if import.type.blank? || import.data.blank? - - # We parse because newlines could be part of individual rows. This - # runs on create so we should be reading the local file here before - # it is uploaded to object storage or moved anywhere... - csv_data = CSV.parse(import.data.queued_for_write[:original].read) - - row_count = csv_data.size - row_count -= 1 if csv_data.first&.first == FIRST_HEADER - - import.errors.add(:data, I18n.t('imports.errors.over_rows_processing_limit', count: Admin::DomainBlocksController::ROWS_PROCESSING_LIMIT)) if row_count > Admin::DomainBlocksController::ROWS_PROCESSING_LIMIT - end -end |