exports_controller.rb 599 B

12345678910111213141516171819202122232425262728
  1. # frozen_string_literal: true
  2. class Settings::ExportsController < Settings::BaseController
  3. include Authorization
  4. include Redisable
  5. include Lockable
  6. skip_before_action :check_self_destruct!
  7. skip_before_action :require_functional!
  8. def show
  9. @export = Export.new(current_account)
  10. @backups = current_user.backups
  11. end
  12. def create
  13. backup = nil
  14. with_redis_lock("backup:#{current_user.id}") do
  15. authorize :backup, :create?
  16. backup = current_user.backups.create!
  17. end
  18. BackupWorker.perform_async(backup.id)
  19. redirect_to settings_export_path
  20. end
  21. end