Put current user first, closes #2063

This commit is contained in:
Toks
2015-04-23 09:43:19 -04:00
parent 6ff02c653d
commit c56d16d336
2 changed files with 5 additions and 0 deletions

View File

@@ -301,6 +301,7 @@
url: "/users.json",
data: {
"search[order]": "post_upload_count",
"search[current_user_first]": "true",
"search[name_matches]": term + "*",
"limit": 10,
},

View File

@@ -711,6 +711,10 @@ class User < ActiveRecord::Base
if params[:id].present?
q = q.where("id in (?)", params[:id].split(",").map(&:to_i))
end
if params[:current_user_first] == "true" && !CurrentUser.is_anonymous?
q = q.order("id = #{CurrentUser.user.id.to_i} desc")
end
case params[:order]
when "name"