Put current user first, closes #2063
This commit is contained in:
@@ -301,6 +301,7 @@
|
|||||||
url: "/users.json",
|
url: "/users.json",
|
||||||
data: {
|
data: {
|
||||||
"search[order]": "post_upload_count",
|
"search[order]": "post_upload_count",
|
||||||
|
"search[current_user_first]": "true",
|
||||||
"search[name_matches]": term + "*",
|
"search[name_matches]": term + "*",
|
||||||
"limit": 10,
|
"limit": 10,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -712,6 +712,10 @@ class User < ActiveRecord::Base
|
|||||||
q = q.where("id in (?)", params[:id].split(",").map(&:to_i))
|
q = q.where("id in (?)", params[:id].split(",").map(&:to_i))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if params[:current_user_first] == "true" && !CurrentUser.is_anonymous?
|
||||||
|
q = q.order("id = #{CurrentUser.user.id.to_i} desc")
|
||||||
|
end
|
||||||
|
|
||||||
case params[:order]
|
case params[:order]
|
||||||
when "name"
|
when "name"
|
||||||
q = q.order("name")
|
q = q.order("name")
|
||||||
|
|||||||
Reference in New Issue
Block a user