about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-03-24 10:53:50 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-03-24 10:53:50 +0100
commitf60c99a8fb0c99554fce091cac61d9ed07eef573 (patch)
tree27457a4e091b820269daedb2f709ca304bcf5d06 /app/services
parentd7c1c41859549212a6d34ad869fded16acc17b48 (diff)
parent88d69d3261c2f02278d07dc302ff7fc15bd68e8c (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'app/services')
-rw-r--r--app/services/delete_account_service.rb3
-rw-r--r--app/services/import_service.rb4
2 files changed, 3 insertions, 4 deletions
diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb
index 802799ccd..182f0e127 100644
--- a/app/services/delete_account_service.rb
+++ b/app/services/delete_account_service.rb
@@ -188,8 +188,7 @@ class DeleteAccountService < BaseService
       ids = favourites.pluck(:status_id)
       StatusStat.where(status_id: ids).update_all('favourites_count = GREATEST(0, favourites_count - 1)')
       Chewy.strategy.current.update(StatusesIndex::Status, ids) if Chewy.enabled?
-      # Rails.cache.delete_multi would be better, but we don't have it yet
-      ids.each { |id| Rails.cache.delete("statuses/#{id}") }
+      Rails.cache.delete_multi(ids.map { |id| "statuses/#{id}" })
       favourites.delete_all
     end
   end
diff --git a/app/services/import_service.rb b/app/services/import_service.rb
index b11532283..74ad5b79f 100644
--- a/app/services/import_service.rb
+++ b/app/services/import_service.rb
@@ -45,7 +45,7 @@ class ImportService < BaseService
     items = @data.take(ROWS_PROCESSING_LIMIT).map { |row| row['#domain'].strip }
 
     if @import.overwrite?
-      presence_hash = items.each_with_object({}) { |id, mapping| mapping[id] = true }
+      presence_hash = items.index_with(true)
 
       @account.domain_blocks.find_each do |domain_block|
         if presence_hash[domain_block.domain]
@@ -96,7 +96,7 @@ class ImportService < BaseService
     items = @data.take(ROWS_PROCESSING_LIMIT).map { |row| row['#uri'].strip }
 
     if @import.overwrite?
-      presence_hash = items.each_with_object({}) { |id, mapping| mapping[id] = true }
+      presence_hash = items.index_with(true)
 
       @account.bookmarks.find_each do |bookmark|
         if presence_hash[bookmark.status.uri]