FIX: Restore join to user_emails for backwards compatibility

Followup to a8310b4b
This commit is contained in:
David Taylor 2020-07-21 20:41:21 +01:00
parent ec4cd46ea2
commit e31454e014
No known key found for this signature in database
GPG Key ID: 46904C18B1D3F434
1 changed files with 4 additions and 0 deletions

View File

@ -141,6 +141,10 @@ after_initialize do
)", topics.map(&:id))
.select(lookup_columns)
if !defined?(UserLookup) # Remove after Discourse 2.6.0
users = users.joins('join user_emails on user_emails.user_id = users.id AND user_emails.primary')
end
map = {}
users.each { |u| map[u.id] = u }