diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-01-25 05:22:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-25 05:22:35 +0100 |
commit | 71921f6bc35b3bbcca8147b20befea113a21dd1f (patch) | |
tree | 816524f59bc3b6ebca536cfea55619ffcf695638 /app/models | |
parent | b89e6cfe7071901a43d1bfbde9dc7b872443e1b2 (diff) |
Fix user disabling changing activity timestamps, fix nil error (#12943)
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 058a8d5f8..85ee5cd06 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -128,9 +128,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! @@ -301,7 +299,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 |