Merge commit '2016c5d912f400ae98ee03ce269112de2f9ec62d' into glitch-soc/merge-upstream

Conflicts:
- `config/initializers/cors.rb`:
  Upstream refactored this file, and glitch-soc had local changes.
  I could not find the rationale for the glitch-soc changes, so I
  used upstream's version.
This commit is contained in:
Claire
2023-10-08 16:41:56 +02:00
16 changed files with 115 additions and 122 deletions
+16 -8
View File
@@ -43,14 +43,14 @@ class Form::Import
validate :validate_data
def guessed_type
return :muting if csv_data.headers.include?('Hide notifications')
return :following if csv_data.headers.include?('Show boosts') || csv_data.headers.include?('Notify on new posts') || csv_data.headers.include?('Languages')
return :following if data.original_filename&.start_with?('follows') || data.original_filename&.start_with?('following_accounts')
return :blocking if data.original_filename&.start_with?('blocks') || data.original_filename&.start_with?('blocked_accounts')
return :muting if data.original_filename&.start_with?('mutes') || data.original_filename&.start_with?('muted_accounts')
return :domain_blocking if data.original_filename&.start_with?('domain_blocks') || data.original_filename&.start_with?('blocked_domains')
return :bookmarks if data.original_filename&.start_with?('bookmarks')
return :lists if data.original_filename&.start_with?('lists')
return :muting if csv_headers_match?('Hide notifications')
return :following if csv_headers_match?('Show boosts') || csv_headers_match?('Notify on new posts') || csv_headers_match?('Languages')
return :following if file_name_matches?('follows') || file_name_matches?('following_accounts')
return :blocking if file_name_matches?('blocks') || file_name_matches?('blocked_accounts')
return :muting if file_name_matches?('mutes') || file_name_matches?('muted_accounts')
return :domain_blocking if file_name_matches?('domain_blocks') || file_name_matches?('blocked_domains')
return :bookmarks if file_name_matches?('bookmarks')
return :lists if file_name_matches?('lists')
end
# Whether the uploaded CSV file seems to correspond to a different import type than the one selected
@@ -79,6 +79,14 @@ class Form::Import
private
def file_name_matches?(string)
data.original_filename&.start_with?(string)
end
def csv_headers_match?(string)
csv_data.headers.include?(string)
end
def default_csv_headers
case type.to_sym
when :following, :blocking, :muting
+1 -1
View File
@@ -19,7 +19,7 @@ class ReportFilter
scope = Report.unresolved
params.each do |key, value|
scope = scope.merge scope_for(key, value), rewhere: true
scope = scope.merge scope_for(key, value)
end
scope