From 32ff78f7496012d9fca5b1ad13cddb650184b5ec Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 28 Sep 2019 01:33:02 +0200 Subject: Fix index not being used in Status.reblogs_map (#11982) Regression from #11623 --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/status.rb') diff --git a/app/models/status.rb b/app/models/status.rb index 471bb03b4..6afaa14d1 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -305,7 +305,7 @@ class Status < ApplicationRecord end def reblogs_map(status_ids, account_id) - select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).reorder(nil).each_with_object({}) { |s, h| h[s.reblog_of_id] = true } + select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).unscoped.each_with_object({}) { |s, h| h[s.reblog_of_id] = true } end def mutes_map(conversation_ids, account_id) -- cgit From 50af41a00daaa99150b0fa92be0c9bde44ced273 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 28 Sep 2019 05:23:32 +0200 Subject: Fix unscoped being used in the wrong place (#11987) Regression from #11982 --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/status.rb') diff --git a/app/models/status.rb b/app/models/status.rb index 6afaa14d1..5e7474577 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -305,7 +305,7 @@ class Status < ApplicationRecord end def reblogs_map(status_ids, account_id) - select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).unscoped.each_with_object({}) { |s, h| h[s.reblog_of_id] = true } + unscoped.select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).each_with_object({}) { |s, h| h[s.reblog_of_id] = true } end def mutes_map(conversation_ids, account_id) -- cgit