Add UI for setting up account migration (#5832)
This commit is contained in:
parent
ff78c1177a
commit
706e534455
7 changed files with 90 additions and 1 deletions
32
app/controllers/settings/migrations_controller.rb
Normal file
32
app/controllers/settings/migrations_controller.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Settings::MigrationsController < ApplicationController
|
||||
layout 'admin'
|
||||
|
||||
before_action :authenticate_user!
|
||||
|
||||
def show
|
||||
@migration = Form::Migration.new(account: current_account.moved_to_account)
|
||||
end
|
||||
|
||||
def update
|
||||
@migration = Form::Migration.new(resource_params)
|
||||
|
||||
if @migration.valid?
|
||||
if current_account.moved_to_account_id != @migration.account&.id
|
||||
current_account.update!(moved_to_account: @migration.account)
|
||||
ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
|
||||
end
|
||||
|
||||
redirect_to settings_migration_path
|
||||
else
|
||||
render :show
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def resource_params
|
||||
params.require(:migration).permit(:acct)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue