diff options
author | Brandon Labuschagne <blabuschagne@gitlab.com> | 2019-01-07 13:54:41 +0200 |
---|---|---|
committer | Brandon Labuschagne <blabuschagne@gitlab.com> | 2019-02-05 17:56:51 +0200 |
commit | d279cc94088fddd6f6bb2847e456bbf68ae616ea (patch) | |
tree | f3c16dbcc9f7b927a2f4ed63cbd286a70ae49a13 /app/models/user.rb | |
parent | 55cb4bc9cafca0c838192b54f9daa4b2bc0b86b0 (diff) | |
download | gitlab-ce-d279cc94088fddd6f6bb2847e456bbf68ae616ea.tar.gz |
Add last activity to user administration
The columns 'Created on' and 'Last activity' have been
added to the admin -> users view.
Sorting options have also been added for last activity
and the search bar has been moved to match the issues
page.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 691abe3175f..9c091ac366c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -267,6 +267,8 @@ class User < ApplicationRecord scope :without_projects, -> { joins('LEFT JOIN project_authorizations ON users.id = project_authorizations.user_id').where(project_authorizations: { user_id: nil }) } scope :order_recent_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'DESC')) } scope :order_oldest_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'ASC')) } + scope :order_recent_last_activity, -> { reorder(Gitlab::Database.nulls_last_order('last_activity_on', 'DESC')) } + scope :order_oldest_last_activity, -> { reorder(Gitlab::Database.nulls_first_order('last_activity_on', 'ASC')) } scope :confirmed, -> { where.not(confirmed_at: nil) } scope :by_username, -> (usernames) { iwhere(username: Array(usernames).map(&:to_s)) } scope :for_todos, -> (todos) { where(id: todos.select(:user_id)) } @@ -337,6 +339,8 @@ class User < ApplicationRecord case order_method.to_s when 'recent_sign_in' then order_recent_sign_in when 'oldest_sign_in' then order_oldest_sign_in + when 'last_activity_on_desc' then order_recent_last_activity + when 'last_activity_on_asc' then order_oldest_last_activity else order_by(order_method) end |