mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:15:05 +08:00
FIX: include pinned status in search results
This commit is contained in:
parent
88f38f34cc
commit
50f7616d04
|
@ -25,6 +25,8 @@ class SearchController < ApplicationController
|
|||
search = Search.new(params[:q], search_args)
|
||||
result = search.execute
|
||||
|
||||
result.find_user_data(guardian)
|
||||
|
||||
serializer = serialize_data(result, GroupedSearchResultSerializer, result: result)
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -25,6 +25,14 @@ class Search
|
|||
@users = []
|
||||
end
|
||||
|
||||
def find_user_data(guardian)
|
||||
if user = guardian.user
|
||||
topics = @posts.map(&:topic)
|
||||
topic_lookup = TopicUser.lookup_for(user, topics)
|
||||
topics.each { |ft| ft.user_data = topic_lookup[ft.id] }
|
||||
end
|
||||
end
|
||||
|
||||
def blurb(post)
|
||||
GroupedSearchResults.blurb_for(post.cooked, @term, @blurb_length)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user