修改关注的排序
This commit is contained in:
parent
28a839445f
commit
c85dc3b57d
|
@ -83,19 +83,19 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def watch_users
|
||||
watchers = @project.watchers.includes(:user).order("watchers.created_at asc").distinct
|
||||
watchers = @project.watchers.includes(:user).order("watchers.created_at desc").distinct
|
||||
@watchers_count = watchers.size
|
||||
@watchers = paginate(watchers)
|
||||
end
|
||||
|
||||
def praise_users
|
||||
praises = @project.praise_treads.includes(:user).order("praise_treads.created_at asc").distinct
|
||||
praises = @project.praise_treads.includes(:user).order("praise_treads.created_at desc").distinct
|
||||
@praises_count = praises.size
|
||||
@praises = paginate(praises)
|
||||
end
|
||||
|
||||
def fork_users
|
||||
fork_users = @project.fork_users.includes(:user, :project).order("fork_users.created_at asc").distinct
|
||||
fork_users = @project.fork_users.includes(:user, :project).order("fork_users.created_at desc").distinct
|
||||
@forks_count = fork_users.size
|
||||
@fork_users = paginate(fork_users)
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def watch_users
|
||||
watchers = Watcher.watching_users(@user.id).includes(:user).order("watchers.created_at asc")
|
||||
watchers = Watcher.watching_users(@user.id).includes(:user).order("watchers.created_at desc")
|
||||
if params[:search].present?
|
||||
search_user_ids = User.where(id: watchers.pluck(:watchable_id)).like(params[:search]).pluck(:id)
|
||||
watchers = watchers.where(watchable_id: search_user_ids)
|
||||
|
@ -33,7 +33,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def fan_users
|
||||
watchers = @user.watchers.includes(:user).order("watchers.created_at asc")
|
||||
watchers = @user.watchers.includes(:user).order("watchers.created_at desc")
|
||||
watchers = watchers.joins(:user).where("LOWER(concat(users.lastname, users.firstname, users.login)) LIKE ?", "%#{params[:search].split(" ").join('|')}%") if params[:search].present?
|
||||
|
||||
@watchers_count = watchers.size
|
||||
|
|
Loading…
Reference in New Issue