mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-12 21:00:58 +00:00
Resolves #105 - Give admins possibility to search users by their lastip
This commit is contained in:
parent
b07ddb4632
commit
632ed2b831
1 changed files with 8 additions and 3 deletions
|
@ -3,10 +3,15 @@ class UsersController < ApplicationController
|
||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if params[:filter] == 'lately'
|
search = params[:search]
|
||||||
@users = User.search(params[:search]).lately.paginate(per_page: 40, page: params[:page])
|
if search && search.match(/^ip:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) && cuser && cuser.admin?
|
||||||
|
@users = User.where(lastip: $1).paginate(per_page: 40, page: params[:page])
|
||||||
else
|
else
|
||||||
@users = User.search(params[:search]).paginate(per_page: 40, page: params[:page])
|
if params[:filter] == 'lately'
|
||||||
|
@users = User.search(params[:search]).lately.paginate(per_page: 40, page: params[:page])
|
||||||
|
else
|
||||||
|
@users = User.search(params[:search]).paginate(per_page: 40, page: params[:page])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue