diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-03-25 00:31:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 00:31:15 +0100 |
commit | a2a85d5ae03282c6f9cbf452b9b8f7d948a9f380 (patch) | |
tree | f3f15ea30de78e0fabaa5135a3b3c7b51053e4b6 /app/services | |
parent | d7c1c41859549212a6d34ad869fded16acc17b48 (diff) | |
parent | 5ea53b6158c42660aa61da2a49a3bbf9e2e406d0 (diff) |
Merge pull request #1516 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/delete_account_service.rb | 3 | ||||
-rw-r--r-- | app/services/import_service.rb | 4 |
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] |