Skip to content

Commit

Permalink
Merge pull request #13 from Bridge2Hyku/master
Browse files Browse the repository at this point in the history
fixes current_user variable retaining on queued jobs.
  • Loading branch information
sephirothkod authored Sep 27, 2018
2 parents 43b2afd + 8729953 commit e10b14a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/jobs/csv_upload_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class CsvUploadJob < ActiveJob::Base


def perform(csv, mvs, current_user)
@current_user = current_user
@csv = CSV.parse(File.read(csv), headers: true, encoding: 'utf-8').map(&:to_hash)
@mvs = mvs
@works = []
Expand Down Expand Up @@ -44,15 +45,15 @@ def secondary_terms form_name
def create_file_from_url(url, file_name, work, file_data)
::FileSet.new(import_url: url, label: file_name) do |fs|
fs.save
actor = Hyrax::Actors::FileSetActor.new(fs, current_user)
actor = Hyrax::Actors::FileSetActor.new(fs, @current_user)
actor.create_metadata#(work, visibility: work.visibility)
actor.attach_file_to_work(work)
#byebug
fs.attributes = file_data
fs.save!
uri = URI.parse(url.gsub(' ','%20'))
if uri.scheme == 'file'
IngestLocalFileJob.perform_later(fs, uri.path.gsub('%20',' '), current_user)
IngestLocalFileJob.perform_later(fs, uri.path.gsub('%20',' '), @current_user)
else
ImportUrlJob.perform_later(fs, log(actor.user))
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cdm_migrator/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CdmMigrator
VERSION = '1.4.3'
VERSION = '1.4.4'
end

0 comments on commit e10b14a

Please sign in to comment.