docbrown/app/workers/export_content_worker.rb
Andy Zhao b80dae1436
Update data exporter to handle admin send (#10274)
* Update data exporter to handle admin send

* Match button with everything else

* Use proper redirect path

* Stub SiteConfig definition instead of setting it

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Removed if statement by accident oops

* Remove non-functional boolean param and pass email directly

* Use refinement to conv to boolean instead of JSON.parse

* Rename to StringToBoolean

* Use 'using' in proper scope (not in method)

* Rename to_bool to to_boolean

* Refactor if statement, thanks rhymes!

* Fix small bugs in tests

* Remove tracking for export_email b/c no @user

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2020-10-26 18:00:56 -04:00

11 lines
262 B
Ruby

class ExportContentWorker
include Sidekiq::Worker
sidekiq_options queue: :medium_priority, retry: 10, lock: :until_executed
def perform(user_id, email)
user = User.find_by(id: user_id)
Exporter::Service.new(user).export(email) if user
end
end