Commit 8b9f30c3 by Arjun Singh

Fix ordering for active_threads; revert change from pinned? to pinned until…

Fix ordering for active_threads; revert change from pinned? to pinned until Kevin can confirm it's correct.
parent 893efa86
......@@ -31,7 +31,13 @@ get "#{APIPREFIX}/users/:user_id/active_threads" do |user_id|
paged_active_contents = active_contents.page(page).per(per_page)
paged_thread_ids = paged_active_contents.map(&get_thread_id).uniq
paged_active_threads = CommentThread.find(paged_thread_ids)
# Find all the threads by id, and then put them in the order found earlier.
# Necessary because CommentThread.find does return results in the same
# order as the provided ids.
paged_active_threads = CommentThread.find(paged_thread_ids).sort_by do |t|
paged_thread_ids.index(t.id)
end
# Fetch all the usernames in bulk to save on queries. Since we're using the
# identity map, the users won't need to be fetched again later.
......
......@@ -178,7 +178,7 @@ class CommentThread < Content
"tags" => tags_array,
"type" => "thread",
"group_id" => group_id,
"pinned" => pinned,
"pinned" => pinned?,
"endorsed" => endorsed?)
if params[:recursive]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment