about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-01-25 12:23:47 +0100
committerGitHub <noreply@github.com>2020-01-25 12:23:47 +0100
commit340cb4a04c94f9403673d59e552be909fce25ece (patch)
tree6b5f1b95e8b8bd9dcdbad167e3f74097a6bea3c6 /app/models
parent0be67df4f0a64367d9e376b06bd3fd2fb9ca8195 (diff)
parent4e1efacfac29cbd4ba3ff675abaa923bb53fcbc8 (diff)
Merge pull request #1266 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb6
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