mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-11-15 01:11:23 +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
|
||||
|
||||
def index
|
||||
if params[:filter] == 'lately'
|
||||
@users = User.search(params[:search]).lately.paginate(per_page: 40, page: params[:page])
|
||||
search = params[:search]
|
||||
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
|
||||
@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
|
||||
|
||||
|
|
Loading…
Reference in a new issue