preload email correctly (not backwards compat with stable)
This commit is contained in:
parent
1c70a81ac4
commit
70911cbd43
|
|
@ -263,12 +263,13 @@ SQL
|
|||
allowed_access = SiteSetting.assigns_public || is_staff
|
||||
|
||||
if allowed_access && topics.length > 0
|
||||
users = User.where("id in (
|
||||
users = User.where("users.id in (
|
||||
SELECT value::int
|
||||
FROM topic_custom_fields
|
||||
WHERE name = 'assigned_to_id' AND topic_id IN (?)
|
||||
)", topics.map(&:id))
|
||||
.select(:id, :email, :username, :uploaded_avatar_id)
|
||||
.joins('join user_emails on user_emails.user_id = users.id AND user_emails.primary')
|
||||
.select(:id, 'user_emails.email', :username, :uploaded_avatar_id)
|
||||
|
||||
map = {}
|
||||
users.each { |u| map[u.id] = u }
|
||||
|
|
@ -389,12 +390,10 @@ SQL
|
|||
|
||||
Discourse::Application.routes.append do
|
||||
mount ::DiscourseAssign::Engine, at: "/assign"
|
||||
get "topics/private-messages-assigned/:username" => "list#private_messages_assigned",
|
||||
as: "topics_private_messages_assigned", constraints: {username: /[\w.\-]+?/}
|
||||
get "topics/private-messages-assigned/:username" => "list#private_messages_assigned", as: "topics_private_messages_assigned", constraints: { username: /[\w.\-]+?/ }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
on(:post_created) do |post|
|
||||
::TopicAssigner.auto_assign(post, force: true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'integration tests' do
|
||||
it 'preloads data in topic list' do
|
||||
admin = Fabricate(:admin)
|
||||
post = create_post
|
||||
list = TopicList.new("latest", admin, [post.topic])
|
||||
TopicList.preload([post.topic], list)
|
||||
# should not explode for now
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue