From e8875c6046615778c7ae6f1fc0c4a195fb5d3a03 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 30 Mar 2017 19:42:33 +0200 Subject: Import feature for following/blocking lists (addresses #62, #177, #201, #454) --- app/controllers/settings/imports_controller.rb | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 app/controllers/settings/imports_controller.rb (limited to 'app/controllers/settings/imports_controller.rb') diff --git a/app/controllers/settings/imports_controller.rb b/app/controllers/settings/imports_controller.rb new file mode 100644 index 000000000..cbb5e65da --- /dev/null +++ b/app/controllers/settings/imports_controller.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +class Settings::ImportsController < ApplicationController + layout 'admin' + + before_action :authenticate_user! + before_action :set_account + + def show + @import = Import.new + end + + def create + @import = Import.new(import_params) + @import.account = @account + + if @import.save + ImportWorker.perform_async(@import.id) + redirect_to settings_import_path, notice: I18n.t('imports.success') + else + render action: :show + end + end + + private + + def set_account + @account = current_user.account + end + + def import_params + params.require(:import).permit(:data, :type) + end +end -- cgit