0
0
Fork 0

Add account migration UI (#11846)

Fix #10736

- Change data export to be available for non-functional accounts
- Change non-functional accounts to include redirecting accounts
This commit is contained in:
Eugen Rochko 2019-09-19 20:58:19 +02:00 committed by GitHub
parent b6df9c1067
commit 3ed94dcc1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 542 additions and 73 deletions

View file

@ -1,16 +1,22 @@
%h3= t('auth.status.account_status')
- if @user.account.suspended?
%span.negative-hint= t('user_mailer.warning.explanation.suspend')
- elsif @user.disabled?
%span.negative-hint= t('user_mailer.warning.explanation.disable')
- elsif @user.account.silenced?
%span.warning-hint= t('user_mailer.warning.explanation.silence')
- elsif !@user.confirmed?
%span.warning-hint= t('auth.status.confirming')
- elsif !@user.approved?
%span.warning-hint= t('auth.status.pending')
- else
%span.positive-hint= t('auth.status.functional')
.simple_form
%p.hint
- if @user.account.suspended?
%span.negative-hint= t('user_mailer.warning.explanation.suspend')
- elsif @user.disabled?
%span.negative-hint= t('user_mailer.warning.explanation.disable')
- elsif @user.account.silenced?
%span.warning-hint= t('user_mailer.warning.explanation.silence')
- elsif !@user.confirmed?
%span.warning-hint= t('auth.status.confirming')
= link_to t('auth.didnt_get_confirmation'), new_user_confirmation_path
- elsif !@user.approved?
%span.warning-hint= t('auth.status.pending')
- elsif @user.account.moved_to_account_id.present?
%span.positive-hint= t('auth.status.redirecting_to', acct: @user.account.moved_to_account.acct)
= link_to t('migrations.cancel'), settings_migration_path
- else
%span.positive-hint= t('auth.status.functional')
%hr.spacer/

View file

@ -13,7 +13,7 @@
.fields-row__column.fields-group.fields-row__column-6
= f.input :email, wrapper: :with_label, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }, required: true, disabled: current_account.suspended?
.fields-row__column.fields-group.fields-row__column-6
= f.input :current_password, wrapper: :with_label, input_html: { 'aria-label' => t('simple_form.labels.defaults.current_password'), :autocomplete => 'off' }, required: true, disabled: current_account.suspended?
= f.input :current_password, wrapper: :with_label, input_html: { 'aria-label' => t('simple_form.labels.defaults.current_password'), :autocomplete => 'off' }, required: true, disabled: current_account.suspended?, hint: false
.fields-row
.fields-row__column.fields-group.fields-row__column-6

View file

@ -0,0 +1,29 @@
- content_for :page_title do
= t('settings.aliases')
= simple_form_for @alias, url: settings_aliases_path do |f|
= render 'shared/error_messages', object: @alias
%p.hint= t('aliases.hint_html')
%hr.spacer/
.fields-group
= f.input :acct, wrapper: :with_block_label, input_html: { autocapitalize: 'none', autocorrect: 'off' }
.actions
= f.button :button, t('aliases.add_new'), type: :submit, class: 'button'
%hr.spacer/
.table-wrapper
%table.table.inline-table
%thead
%tr
%th= t('simple_form.labels.account_alias.acct')
%th
%tbody
- @aliases.each do |account_alias|
%tr
%td= account_alias.acct
%td= table_link_to 'trash', t('aliases.remove'), settings_alias_path(account_alias), data: { method: :delete }

View file

@ -37,12 +37,16 @@
%td= number_with_delimiter @export.total_domain_blocks
%td= table_link_to 'download', t('exports.csv'), settings_exports_domain_blocks_path(format: :csv)
%hr.spacer/
%p.muted-hint= t('exports.archive_takeout.hint_html')
- if policy(:backup).create?
%p= link_to t('exports.archive_takeout.request'), settings_export_path, class: 'button', method: :post
- unless @backups.empty?
%hr.spacer/
.table-wrapper
%table.table
%thead

View file

@ -1,17 +1,85 @@
- content_for :page_title do
= t('settings.migrate')
= simple_form_for @migration, as: :migration, url: settings_migration_path, html: { method: :put } do |f|
- if @migration.account
%p.hint= t('migrations.currently_redirecting')
.simple_form
- if current_account.moved_to_account.present?
.fields-row
.fields-row__column.fields-group.fields-row__column-6
= render 'application/card', account: current_account.moved_to_account
.fields-row__column.fields-group.fields-row__column-6
%p.hint
%span.positive-hint= t('migrations.redirecting_to', acct: current_account.moved_to_account.acct)
.fields-group
= render partial: 'application/card', locals: { account: @migration.account }
%p.hint= t('migrations.cancel_explanation')
%p.hint= link_to t('migrations.cancel'), cancel_settings_migration_path, data: { method: :post }
- else
%p.hint
%span.positive-hint= t('migrations.not_redirecting')
%hr.spacer/
%h3= t 'migrations.proceed_with_move'
= simple_form_for @migration, url: settings_migration_path do |f|
- if on_cooldown?
%span.warning-hint= t('migrations.on_cooldown', count: ((@cooldown.cooldown_at - Time.now.utc) / 1.day.seconds).ceil)
- else
%p.hint= t('migrations.warning.before')
%ul.hint
%li.warning-hint= t('migrations.warning.followers')
%li.warning-hint= t('migrations.warning.other_data')
%li.warning-hint= t('migrations.warning.backreference_required')
%li.warning-hint= t('migrations.warning.cooldown')
%li.warning-hint= t('migrations.warning.disabled_account')
%hr.spacer/
= render 'shared/error_messages', object: @migration
.fields-group
= f.input :acct, placeholder: t('migrations.acct')
.fields-row
.fields-row__column.fields-group.fields-row__column-6
= f.input :acct, wrapper: :with_block_label, input_html: { autocapitalize: 'none', autocorrect: 'off' }, disabled: on_cooldown?
.fields-row__column.fields-group.fields-row__column-6
- if current_user.encrypted_password.present?
= f.input :current_password, wrapper: :with_block_label, input_html: { :autocomplete => 'off' }, required: true, disabled: on_cooldown?
- else
= f.input :current_username, wrapper: :with_block_label, input_html: { :autocomplete => 'off' }, required: true, disabled: on_cooldown?
.actions
= f.button :button, t('migrations.proceed'), type: :submit, class: 'negative'
= f.button :button, t('migrations.proceed_with_move'), type: :submit, class: 'button button--destructive', disabled: on_cooldown?
- unless @migrations.empty?
%hr.spacer/
%h3= t 'migrations.past_migrations'
%hr.spacer/
.table-wrapper
%table.table.inline-table
%thead
%tr
%th= t('migrations.acct')
%th= t('migrations.followers_count')
%th
%tbody
- @migrations.each do |migration|
%tr
%td
- if migration.target_account.present?
= compact_account_link_to migration.target_account
- else
= migration.acct
%td= number_with_delimiter migration.followers_count
%td
%time.time-ago{ datetime: migration.created_at.iso8601, title: l(migration.created_at) }= l(migration.created_at)
%hr.spacer/
%h3= t 'migrations.incoming_migrations'
%p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path)

View file

@ -60,6 +60,11 @@
%h6= t('auth.migrate_account')
%p.muted-hint= t('auth.migrate_account_html', path: settings_migration_path)
%hr.spacer/
%h6= t 'migrations.incoming_migrations'
%p.muted-hint= t('migrations.incoming_migrations_html', path: settings_aliases_path)
- if open_deletion?
%hr.spacer/