diff options
author | Poornima M <poornima.malepati@gmail.com> | 2017-01-19 16:40:13 +0530 |
---|---|---|
committer | Poornima M <poornima.malepati@gmail.com> | 2017-01-24 18:42:55 +0530 |
commit | 8354c76f39f5f922a23b294169f428ced87c75b5 (patch) | |
tree | 9e3435216e9085c2e8929a4902f8d07dfb874ee8 /app/models/user.rb | |
parent | 0fd7919e77b61616e6e8a79fa415535760de31fc (diff) | |
download | gitlab-ce-8354c76f39f5f922a23b294169f428ced87c75b5.tar.gz |
Fixing sort of Users so that users who never logged in will be displayed last
Adding changelog entry
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 06dd98a3188..2caa66dd9f7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -179,8 +179,8 @@ class User < ActiveRecord::Base scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : all } scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM members WHERE user_id IS NOT NULL AND requested_at IS NULL)') } scope :todo_authors, ->(user_id, state) { where(id: Todo.where(user_id: user_id, state: state).select(:author_id)) } - scope :order_recent_sign_in, -> { reorder(last_sign_in_at: :desc) } - scope :order_oldest_sign_in, -> { reorder(last_sign_in_at: :asc) } + scope :order_recent_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('last_sign_in_at', 'DESC')) } + scope :order_oldest_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('last_sign_in_at', 'ASC')) } def self.with_two_factor joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id"). |