]> cat aescling's git repositories - mastodon.git/commitdiff
Fix User#active scope only returning suspended users (#11111)
authorThibG <thib@sitedethib.com>
Tue, 18 Jun 2019 16:22:02 +0000 (18:22 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 18 Jun 2019 16:22:02 +0000 (18:22 +0200)
Fix a regression from #10660

app/models/user.rb

index eb1a2fecefe9f1f8f067898a467a16430270207c..4abf124fc17cd120084e8ca6b3397dc098b30a6c 100644 (file)
@@ -88,7 +88,7 @@ class User < ApplicationRecord
   scope :confirmed, -> { where.not(confirmed_at: nil) }
   scope :enabled, -> { where(disabled: false) }
   scope :inactive, -> { where(arel_table[:current_sign_in_at].lt(ACTIVE_DURATION.ago)) }
-  scope :active, -> { confirmed.where(arel_table[:current_sign_in_at].gteq(ACTIVE_DURATION.ago)).joins(:account).where.not(accounts: { suspended_at: nil }) }
+  scope :active, -> { confirmed.where(arel_table[:current_sign_in_at].gteq(ACTIVE_DURATION.ago)).joins(:account).where(accounts: { suspended_at: nil }) }
   scope :matches_email, ->(value) { where(arel_table[:email].matches("#{value}%")) }
   scope :emailable, -> { confirmed.enabled.joins(:account).merge(Account.searchable) }