diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-01-25 10:04:41 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-01-25 10:04:41 +0100 |
commit | 61f699c0e907d8525190b115fc619296b4affa98 (patch) | |
tree | 9ed5cc5b4260565bebab4482b3266b911204fa79 /app/models | |
parent | 0be67df4f0a64367d9e376b06bd3fd2fb9ca8195 (diff) | |
parent | f816da9c6474ddf437681fbf7f5346672436ccdf (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 9d5114e74..cd8a6f273 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -129,9 +129,7 @@ class User < ApplicationRecord end def disable! - update!(disabled: true, - last_sign_in_at: current_sign_in_at, - current_sign_in_at: nil) + update!(disabled: true) end def enable! @@ -302,7 +300,7 @@ class User < ApplicationRecord arr << [current_sign_in_at, current_sign_in_ip] if current_sign_in_ip.present? arr << [last_sign_in_at, last_sign_in_ip] if last_sign_in_ip.present? - arr.sort_by(&:first).uniq(&:last).reverse! + arr.sort_by { |pair| pair.first || Time.now.utc }.uniq(&:last).reverse! end end |