1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/app/controllers/settings/imports_controller.rb

32 lines
590 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Settings::ImportsController < Settings::BaseController
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
2017-04-19 06:37:42 -07:00
render :show
end
end
private
def set_account
@account = current_user.account
end
def import_params
params.require(:import).permit(:data, :type, :mode)
end
end