Rewrite import feature (#21054)

This commit is contained in:
Claire
2023-05-02 12:08:48 +02:00
committed by GitHub
parent 0ad2413b35
commit 32a030dd74
40 changed files with 2059 additions and 113 deletions

View File

@@ -64,6 +64,8 @@ ignore_unused:
- 'statuses.attached.*'
- 'move_handler.carry_{mutes,blocks}_over_text'
- 'notification_mailer.*'
- 'imports.overwrite_preambles.{following,blocking,muting,domain_blocking,bookmarks}_html'
- 'imports.preambles.{following,blocking,muting,domain_blocking,bookmarks}_html'
ignore_inconsistent_interpolations:
- '*.one'

View File

@@ -1218,7 +1218,9 @@ en:
all_matching_items_selected_html:
one: "<strong>%{count}</strong> item matching your search is selected."
other: All <strong>%{count}</strong> items matching your search are selected.
cancel: Cancel
changes_saved_msg: Changes successfully saved!
confirm: Confirm
copy: Copy
delete: Delete
deselect: Deselect all
@@ -1234,15 +1236,51 @@ en:
other: Something isn't quite right yet! Please review %{count} errors below
imports:
errors:
empty: Empty CSV file
incompatible_type: Incompatible with the selected import type
invalid_csv_file: 'Invalid CSV file. Error: %{error}'
over_rows_processing_limit: contains more than %{count} rows
too_large: File is too large
failures: Failures
imported: Imported
mismatched_types_warning: It appears you may have selected the wrong type for this import, please double-check.
modes:
merge: Merge
merge_long: Keep existing records and add new ones
overwrite: Overwrite
overwrite_long: Replace current records with the new ones
overwrite_preambles:
blocking_html: You are about to <strong>replace your block list</strong> with up to <strong>%{total_items} accounts</strong> from <strong>%{filename}</strong>.
bookmarks_html: You are about to <strong>replace your bookmarks</strong> with up to <strong>%{total_items} posts</strong> from <strong>%{filename}</strong>.
domain_blocking_html: You are about to <strong>replace your domain block list</strong> with up to <strong>%{total_items} domains</strong> from <strong>%{filename}</strong>.
following_html: You are about to <strong>follow</strong> up to <strong>%{total_items} accounts</strong> from <strong>%{filename}</strong> and <strong>stop following anyone else</strong>.
muting_html: You are about to <strong>replace your list of muted accounts</strong> with up to <strong>%{total_items} accounts</strong> from <strong>%{filename}</strong>.
preambles:
blocking_html: You are about to <strong>block</strong> up to <strong>%{total_items} accounts</strong> from <strong>%{filename}</strong>.
bookmarks_html: You are about to add up to <strong>%{total_items} posts</strong> from <strong>%{filename}</strong> to your <strong>bookmarks</strong>.
domain_blocking_html: You are about to <strong>block</strong> up to <strong>%{total_items} domains</strong> from <strong>%{filename}</strong>.
following_html: You are about to <strong>follow</strong> up to <strong>%{total_items} accounts</strong> from <strong>%{filename}</strong>.
muting_html: You are about to <strong>mute</strong> up to <strong>%{total_items} accounts</strong> from <strong>%{filename}</strong>.
preface: You can import data that you have exported from another server, such as a list of the people you are following or blocking.
recent_imports: Recent imports
states:
finished: Finished
in_progress: In progress
scheduled: Scheduled
unconfirmed: Unconfirmed
status: Status
success: Your data was successfully uploaded and will be processed in due time
time_started: Started at
titles:
blocking: Importing blocked accounts
bookmarks: Importing bookmarks
domain_blocking: Importing blocked domains
following: Importing followed accounts
muting: Importing muted accounts
type: Import type
type_groups:
constructive: Follows & Bookmarks
destructive: Blocks & mutes
types:
blocking: Blocking list
bookmarks: Bookmarks

View File

@@ -26,7 +26,7 @@ SimpleNavigation::Configuration.run do |navigation|
end
n.item :data, safe_join([fa_icon('cloud-download fw'), t('settings.import_and_export')]), settings_export_path do |s|
s.item :import, safe_join([fa_icon('cloud-upload fw'), t('settings.import')]), settings_import_path, if: -> { current_user.functional? }
s.item :import, safe_join([fa_icon('cloud-upload fw'), t('settings.import')]), settings_imports_path, if: -> { current_user.functional? }
s.item :export, safe_join([fa_icon('cloud-download fw'), t('settings.export')]), settings_export_path
end

View File

@@ -144,7 +144,13 @@ Rails.application.routes.draw do
resource :other, only: [:show, :update], controller: :other
end
resource :import, only: [:show, :create]
resources :imports, only: [:index, :show, :destroy, :create] do
member do
post :confirm
get :failures
end
end
resource :export, only: [:show, :create]
namespace :exports, constraints: { format: :csv } do